diff options
author | The Arcane Brony <myrainbowdash949@gmail.com> | 2021-11-11 22:17:21 +0100 |
---|---|---|
committer | The Arcane Brony <myrainbowdash949@gmail.com> | 2021-11-11 22:26:49 +0100 |
commit | a61bba7e27a0d0081d176aac6900c09f7d695428 (patch) | |
tree | 1078bd60443753b59ee102b93daf30fe65701a16 /api | |
parent | Fix autoregister, add inline plugins (diff) | |
download | server-a61bba7e27a0d0081d176aac6900c09f7d695428.tar.xz |
Inline plugin support
Diffstat (limited to 'api')
-rw-r--r-- | api/client_test/index.html | 6 | ||||
-rw-r--r-- | api/package-lock.json | 2 | ||||
-rw-r--r-- | api/src/middlewares/TestClient.ts | 11 |
3 files changed, 13 insertions, 6 deletions
diff --git a/api/client_test/index.html b/api/client_test/index.html index b19d5f0d..0b3a775a 100644 --- a/api/client_test/index.html +++ b/api/client_test/index.html @@ -4,9 +4,9 @@ <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Discord Test Client</title> - <link rel="stylesheet" href="/assets/fosscord.css"/> - <link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css"/> - <link id="customcss" rel="stylesheet" href="/assets/user.css"/> + <link rel="stylesheet" href="/assets/fosscord.css" /> + <link id="logincss" rel="stylesheet" href="/assets/fosscord-login.css" /> + <link id="customcss" rel="stylesheet" href="/assets/user.css" /> <!-- preload plugin marker --> </head> diff --git a/api/package-lock.json b/api/package-lock.json index e8ebd5bf..a4ad6b2b 100644 --- a/api/package-lock.json +++ b/api/package-lock.json @@ -84,6 +84,7 @@ "pg": "^8.7.1", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", + "sqlite3": "^5.0.2", "typeorm": "^0.2.38", "typescript": "^4.4.2", "typescript-json-schema": "^0.50.1" @@ -16162,6 +16163,7 @@ "pg": "^8.7.1", "proxy-agent": "^5.0.0", "reflect-metadata": "^0.1.13", + "sqlite3": "^5.0.2", "ts-node": "^10.2.1", "typeorm": "^0.2.38", "typescript": "^4.4.2", diff --git a/api/src/middlewares/TestClient.ts b/api/src/middlewares/TestClient.ts index 7d981f0c..b50f4e5c 100644 --- a/api/src/middlewares/TestClient.ts +++ b/api/src/middlewares/TestClient.ts @@ -23,10 +23,15 @@ export default function TestClient(app: Application) { if (GATEWAY_ENDPOINT) { html = html.replace(/GATEWAY_ENDPOINT: .+/, `GATEWAY_ENDPOINT: \`${GATEWAY_ENDPOINT}\`,`); } - - //plugins - var files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "plugins")); + // inline plugins + var files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "preload-plugins")); var plugins = ""; + files.forEach(x =>{if(x.endsWith(".js")) plugins += `<script>${fs.readFileSync(path.join(__dirname, "..", "..", "assets", "preload-plugins", x))}</script>\n`; }); + html = html.replaceAll("<!-- preload plugin marker -->", plugins); + + // plugins + files = fs.readdirSync(path.join(__dirname, "..", "..", "assets", "plugins")); + plugins = ""; files.forEach(x =>{if(x.endsWith(".js")) plugins += `<script src='/assets/plugins/${x}'></script>\n`; }); html = html.replaceAll("<!-- plugin marker -->", plugins); //preload plugins |