Go back to hashes

This commit is contained in:
Zack Rauen 2020-07-30 15:55:00 -04:00
parent aca2010621
commit 5d9de576aa
3 changed files with 9 additions and 8 deletions

View File

@ -8,7 +8,7 @@ git:
branches: branches:
only: only:
- stable - development
install: install:
- npm install - npm install
@ -25,6 +25,6 @@ deploy:
keep_history: true keep_history: true
local_dir: . local_dir: .
name: BetterDiscord Deployment name: BetterDiscord Deployment
target_branch: gh-pages target_branch: gh-pages-development
on: on:
branch: stable branch: development

View File

@ -46,8 +46,8 @@ export default new class Core {
{ {
name: "bd-stylesheet", name: "bd-stylesheet",
type: "style", type: "style",
url: "https://rauenzi.github.io/BetterDiscordApp/dist/style.css", url: "//cdn.staticaly.com/gh/rauenzi/BetterDiscordApp/{{hash}}/dist/style.css",
backup: "https://gitcdn.xyz/repo/rauenzi/BetterDiscordApp/gh-pages/dist/style.css", backup: "https://rauenzi.github.io/BetterDiscordApp/dist/style.css",
localPath: "style.css" localPath: "style.css"
} }
]; ];
@ -131,14 +131,14 @@ export default new class Core {
continue; continue;
} }
} }
const url = Utilities.formatString(data.url, {repo: Config.repo, hash: Config.hash}); const url = Utilities.formatString(data.url, {hash: Config.hash});
Logger.log(`Startup`, `Loading Resource (${url})`); Logger.log(`Startup`, `Loading Resource (${url})`);
const injector = (data.type == "script" ? DOMManager.injectScript : DOMManager.linkStyle).bind(DOMManager); const injector = (data.type == "script" ? DOMManager.injectScript : DOMManager.linkStyle).bind(DOMManager);
try { try {
await injector(data.name, url); await injector(data.name, url);
} }
catch (err) { catch (err) {
const backup = Utilities.formatString(data.backup, {minified: Config.minified ? ".min" : ""}); const backup = Utilities.formatString(data.backup);
Logger.stacktrace(`Startup`, `Could not load ${url}. Using backup ${backup}`, err); Logger.stacktrace(`Startup`, `Could not load ${url}. Using backup ${backup}`, err);
try { try {
await injector(data.name, backup); await injector(data.name, backup);

View File

@ -1,10 +1,11 @@
import {Config} from "data";
import Logger from "./logger"; import Logger from "./logger";
import DOM from "./domtools"; import DOM from "./domtools";
export default class Utilities { export default class Utilities {
static repoUrl(path) { static repoUrl(path) {
return `https://gitcdn.xyz/repo/rauenzi/BetterDiscordApp/gh-pages/${path}`; return `https://cdn.staticaly.com/gh/rauenzi/BetterDiscordApp/${Config.hash}/${path}`;
} }
/** /**