mirror of
				https://git.1024x2.xyz/1024x2/vexcord.git
				synced 2025-10-31 01:54:32 +01:00 
			
		
		
		
	Add basic build and inject scripts
Linux-only for now.
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | ||||
| Vencord | ||||
							
								
								
									
										25
									
								
								build.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								build.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| # Pull the patches repository | ||||
| git pull | ||||
|  | ||||
| # Do we have the Vencord sources cloned? | ||||
| if [ -e Vencord/.git ]; then | ||||
| 	# Update sources | ||||
| 	cd Vencord | ||||
| 	git fetch | ||||
| else | ||||
| 	# Clone sources | ||||
| 	git clone https://github.com/Vendicated/Vencord.git Vencord | ||||
| 	cd Vencord | ||||
| fi | ||||
|  | ||||
| # Reset vexcord branch and apply patches | ||||
| git checkout -B vexcord origin/main | ||||
| git am ../*.patch | ||||
|  | ||||
| # Build vencord | ||||
| pnpm i --frozen-lockfile | ||||
| node scripts/build/build.mjs | ||||
							
								
								
									
										59
									
								
								inject.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										59
									
								
								inject.sh
									
									
									
									
									
										Executable file
									
								
							| @@ -0,0 +1,59 @@ | ||||
| #!/usr/bin/env bash | ||||
|  | ||||
| set -euo pipefail | ||||
|  | ||||
| # Wraps the string in quotes, and escapes quotes, backslashes, and newlines. | ||||
| jsonescape() { | ||||
| 	sed -e 's|[\\"]|\\&|g' -e 's|\n|\\n|g' -e 's/^\|$/"/g' | ||||
| } | ||||
|  | ||||
| discord="" | ||||
| if [ "$#" -ge 1 ]; then | ||||
| 	discord="$1" | ||||
| else | ||||
| 	# Find where the system installation of Discord is. | ||||
| 	for path in \ | ||||
| 		/opt/discord \ | ||||
| 		/opt/discord-ptb \ | ||||
| 		/opt/discord-canary \ | ||||
| 		/usr/share/discord \ | ||||
| 		/usr/share/discord-ptb \ | ||||
| 		/usr/share/discord-canary; do | ||||
| 		if [ -d "$path" ]; then | ||||
| 			discord="$path" | ||||
| 			break | ||||
| 		fi | ||||
| 	done | ||||
| 	if [ -z "$discord" ]; then | ||||
| 		echo "Could not find your system installation of Discord!" 2>&1 | ||||
| 		echo "Please pass the path to your Discord installation:" 2>&1 | ||||
| 		echo "  $0 [path_to_discord]" 2>&1 | ||||
| 		exit 1 | ||||
| 	fi | ||||
| fi | ||||
|  | ||||
| if [ ! -e "$discord/resources" ]; then | ||||
| 	echo "Directory does not exist: $discord/resources" 2>&1 | ||||
| 	exit 1 | ||||
| elif [ ! -w "$discord/resources" ]; then | ||||
| 	echo "Can't write to directory: $discord/resources" 2>&1 | ||||
| 	echo "If you're installing Vexcord to your system Discord installation," 2>&1 | ||||
| 	echo "try running this script as root. (e.g. using sudo)" 2>&1 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| # Move app.asar to _app.asar | ||||
| if [ -f "$discord/resources/app.asar" ]; then | ||||
| 	mv -T "$discord/resources/app.asar" "$discord/resources/_app.asar" | ||||
| elif [ ! -d "$discord/resources/app.asar" ]; then | ||||
| 	echo "Missing app.asar!" >&2 | ||||
| 	echo "Try reinstalling discord." >&2 | ||||
| 	exit 1 | ||||
| fi | ||||
|  | ||||
| # Make our own fake app.asar that just points to the Vencord patcher. | ||||
| mkdir -p "$discord/resources/app.asar" | ||||
| echo "require($(realpath Vencord/dist/patcher.js | jsonescape))" >"$discord/resources/app.asar/index.js" | ||||
| echo '{"main": "index.js", "name": "discord"}' >"$discord/resources/app.asar/package.json" | ||||
|  | ||||
| echo "Installed Vexcord to: $discord" | ||||
		Reference in New Issue
	
	Block a user