|
3 years ago | |
---|---|---|
src | 3 years ago | |
.gitignore | 3 years ago | |
LICENSE | 3 years ago | |
NOTICE | 3 years ago | |
README.MD | 3 years ago | |
package-lock.json | 3 years ago | |
package.json | 3 years ago | |
tsconfig.json | 3 years ago | |
webpack.config.js | 3 years ago |
README.MD
Discord CSS injector
This project is a very simple CSS injector for Discord, written in Typescript
Features
The injector is very, very simple, so the feature list is rather inextensive:
- Does not modify your Discord installation
- Supports single CSS file
- Hot reloads on any changes
- Persists across Discord reinstallations or updates
- Do note that despite of this, it is not guaranteed the injector will work after updating
Due to its architecture, the injector could be adapted to work with other Discord-like applications, for example Slack.
Installation
Installation is possible in one of 2 ways: either using my automated installer, or manually.
Option 1: automated installer
This option is recommended for most users. It will automatically download and set up any necessary components, and provide easy rollback options. It does, however, require Java.
- Download the latest version of the installer from its release page
- Open your terminal emulator of choice
- Navigate to the directory you downloaded the installer to
- Execute the installer using
java -jar discord-css-injector-installer.jar install
- If you do not specify the location of your CSS file, the default path will be used
- If the specified (or default) file does not exist, a new, empty one will be created
- To specify the CSS file to use, run the program with the path to CSS file as the second argument (i.e.
java -jar discord-css-injector-installer.jar install "D:\stuff\discord.css"
)
- If using Linux, OS X, or another UNIX-based operating system, you might need to log out and log back in for necessary changes to take effect
To uninstall the injector, simply do the following:
- Open your terminal emulator of choice
- Navigate to the directory with the installer
- Execute the installer with
uninstall
option (i.e.java -jar discord-css-injector-installer.jar uninstall
) - If using Linux, OS X, or another UNIX-based operating system, you might need to log out and log back in for necessary changes to take effect
Option 2: manual installation
This option is only recommended for advanced users only.
Windows:
- Download the latest version of the injector from its release page
- Open your terminal emulator of choice
- Go to your application data (
cd "%AppData%"
) - Create a directory called
DiscordCSS
and enter it (mkdir DiscordCSS && cd DiscordCSS
) - Put the downloaded
discord-css-injector.js
file in the directory (copy "%UserProfile%\Downloads\discord-css-injector.js" .
where%UserProfile%\Downloads\discord-css-injector.js
is the path you downloaded the injector to) - Go to Documents (
cd "%UserProfile%\Documents"
) - Create a file called
discord.css
(echo /* Put css overrides in here */ > discord.css
) - Close the terminal emulator (
exit
) - Open the classic Control Panel, go to System and Security > System and click Advanced system settings on the left
- Go to Advanced tab and click the Environment Variables button on the bottom
- In the top pane (User variables...), press New..., and enter
DISCORD_CSS_FILE
in the Variable name field - Press Browse File... button, and select the
discord.css
file in your Documents - Press OK
- Scroll through both panes to see if a
NODE_OPTIONS
variable is already defined - If it is not, press New... under User variables... again, and type
NODE_OPTIONS
in the name field - Press Browse File... button, navigate to
%AppData%\DiscordCSS
(you can paste that in the address bar), and select thediscord-css-injector.js
file - This will place the location to the file in the Variable value field, wrap it in quotes (
"
) if it is not wrapped already, and add--require
with a space after at the beginning of the field (that is, before the opening quote) - Press OK, then press OK in the Environment Variables window
- Restart Discord
- Open the
discord.css
file in your text editor of choice and enjoy
If the NODE_OPTIONS
variable did exist already, you will need to merge its contents with the contents outlined above.
Linux, OS X, other UNIX:
- Open your terminal emulator of choice
- Navigate to your home directory (
cd
) - Create a directory called
.discordcss
and enter it (mkdir .discordcss && cd .discordcss
) - Download the latest version of
discord-css-injector.js
(replacev1.0.0
with the latest version number)
- using wget:
wget https://git.emzi0767.com/Emzi0767/Discord-CSS-Injector/releases/download/v1.0.0/discord-css-injector.js
- using curl:
curl -o discord-css-injector.js https://git.emzi0767.com/Emzi0767/Discord-CSS-Injector/releases/download/v1.0.0/discord-css-injector.js
- using fetch:
fetch https://git.emzi0767.com/Emzi0767/Discord-CSS-Injector/releases/download/v1.0.0/discord-css-injector.js
- Go back to your home directory (
cd
) - Create a file called
discord.css
(touch discord.css
) - Append environment variable settings to your
.profile
cat >> $HOME/.profile <<EOF # STARTOF: DISCORD CSS INJECTOR DISCORD_CSS_FILE="$HOME/discord.css"; export DISCORD_CSS_FILE NODE_OPTIONS="--require $HOME/.discordcss/discord-css-injector.js \$NODE_OPTIONS"; export NODE_OPTIONS # ENDOF: DISCORD CSS INJECTOR EOF
- Close Discord, log out, then log back in, and start Discord again
In order to remove the injector, you will need to perform the following steps:
- Start your favourite terminal emulator
- Close Discord
- Remove the injector's directory (
rm -rf $HOME/.discordcss
) - Remove the appended environment variable settings from
.profile
(sed -ne '/^# STARTOF: DISCORD CSS INJECTOR/,/^# ENDOF: DISCORD CSS INJECTOR/!p' -i '.bak' test
) - Close Discord, log out, then log back in, and start Discord again
Special thanks
I'd like to thank the following people for contributing to the project in one way or another:
- Gus Caplan (devsnek) - for pointing me to
NODE_OPTIONS
and providing a basic way of detecting being run in Discord