From 93d1a264dab37b3c37c79eae1a3e8b6d87595a4d Mon Sep 17 00:00:00 2001 From: Tony Ribeiro Date: Tue, 10 Oct 2023 01:51:09 +0200 Subject: [PATCH] Add official blip asset management. --- public/assets/blip/.placeholder | 1 + public/scripts/extensions/assets/index.js | 7 +++---- src/assets.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 public/assets/blip/.placeholder diff --git a/public/assets/blip/.placeholder b/public/assets/blip/.placeholder new file mode 100644 index 000000000..95839f44e --- /dev/null +++ b/public/assets/blip/.placeholder @@ -0,0 +1 @@ +Put bgm audio files here diff --git a/public/scripts/extensions/assets/index.js b/public/scripts/extensions/assets/index.js index ca149a1cb..374b33a68 100644 --- a/public/scripts/extensions/assets/index.js +++ b/public/scripts/extensions/assets/index.js @@ -1,8 +1,7 @@ /* TODO: - - Check failed install file (0kb size ?) */ -//const DEBUG_TONY_SAMA_FORK_MODE = false +//const DEBUG_TONY_SAMA_FORK_MODE = true import { getRequestHeaders, callPopup } from "../../../script.js"; import { deleteExtension, extensionNames, installExtension } from "../../extensions.js"; @@ -60,7 +59,7 @@ function downloadAssetsList(url) { element.append(label); //if (DEBUG_TONY_SAMA_FORK_MODE) - // assetUrl = assetUrl.replace("https://github.com/SillyTavern/","https://github.com/Tony-sama/"); // DBG + // asset["url"] = asset["url"].replace("https://github.com/SillyTavern/","https://github.com/Tony-sama/"); // DBG console.debug(DEBUG_PREFIX, "Checking asset", asset["id"], asset["url"]); @@ -115,7 +114,7 @@ function downloadAssetsList(url) { element.on("click", assetInstall); } - console.debug(DEBUG_PREFIX, "Created element for BGM", asset["id"]) + console.debug(DEBUG_PREFIX, "Created element for ", asset["id"]) const displayName = DOMPurify.sanitize(asset["name"] || asset["id"]); const description = DOMPurify.sanitize(asset["description"] || ""); diff --git a/src/assets.js b/src/assets.js index 0df564cc0..8ab10750e 100644 --- a/src/assets.js +++ b/src/assets.js @@ -5,7 +5,7 @@ const fetch = require('node-fetch').default; const { finished } = require('stream/promises'); const { DIRECTORIES, UNSAFE_EXTENSIONS } = require('./constants'); -const VALID_CATEGORIES = ["bgm", "ambient"]; +const VALID_CATEGORIES = ["bgm", "ambient", "blip"]; /** * Sanitizes the input filename for theasset.