How to patch a certain web client
So, you want to somehow use vanilla DC client on your private self-hosted DCAS server.
To get everything up and running you have to fetch DC web client, place it in
some directory (lets call this directory client), patch its endpoint urls to
point to DCAS IP/domain and update server’s config.toml, setting
main.assets_directory to your client dir.
If this sounds complicated, the detailed explanation is provided below.
How to fetch data
Server is able to fetch missing resources by itself, so all you have to do is to specify URL to fetch from.
- Adjust
assets_fetch_srcparameter inserver/config.toml;- You can use tor and
"assets_fetch_proxy": "--socks5 localhost:9150",if site is blocked in your country;
- You can use tor and
- Start server:
cargo run; - Open
http://localhost:9000/in browser; - Wait for resources to load (you’ll have to wait until the login page is loaded);
- You should now see standard login page in browser window;
- Please note that you wont be able go any further (i.e. register) unless you modify client’s endpoints.
Also you have to fetch some cdn assets manually:
- /assets/krisp_browser_models/v1.0.11_1/model_32.kw
Hot to modify data
- Edit
client/index.htmlapplying the following:- replace each
//discord.com->//R_MAIN_SHORT, - replace
wss://gateway.discord.gg->R_GW_ENDPOINT_FULL, - set
CDN_HOST: 'R_CDN_SHORT',; - set
MEDIA_PROXY_ENDPOINT: '//R_CDN_SHORT',;
- replace each
- Find and replace in all files:
- update cdn url in all files:
https://cdn.discordapp.com->R_CDN_FULL;cdn.discordapp.com->R_CDN_SHORT
- set proper scheme in endpoints (useful for
http://localhostsetup):return"https:"+window.GLOBAL_ENV.API_ENDPOINT->return "R_API_ENDPOINT_FULL";
- update cdn url in all files:
Also, there is at least one buggy line that looks like this:
let ec = /^https/.test((i = "https:", "https:")) ? "wss:" : "ws:",
You need to edit it to make this:
let ec = location.protocol == 'https:' ? (i = "https:", "wss:") : (i = "http:", "ws:"),
How to fetch all
In case you want to fetch everything at once.
Chunks (js and css)
Look for + ".js" lines.
Collect scripts lists into js.list.txt and transform into lines of full urls.
cd assets
for i in `cat ../js.list.txt` ; do echo $i ; curl -fLO -x socks5://localhost:9150 $i; done
Media
Can get list of .png (or .svg) assets with the following command:
for file in ./assets/* ; do cat $file | tr '"' '\n' | grep -Po '/assets/[0-9a-z]{20}.png' ; done | sort | uniq > png.list.txt