/* TODO: - Check failed install file (0kb size ?) */ //const DEBUG_TONY_SAMA_FORK_MODE = false import { getRequestHeaders, callPopup } from "../../../script.js"; export { MODULE_NAME }; const MODULE_NAME = 'Assets'; const DEBUG_PREFIX = " "; let ASSETS_JSON_URL = "https://raw.githubusercontent.com/SillyTavern/SillyTavern-Content/main/index.json" const extensionName = "assets"; const extensionFolderPath = `scripts/extensions/${extensionName}`; // DBG //if (DEBUG_TONY_SAMA_FORK_MODE) // ASSETS_JSON_URL = "https://raw.githubusercontent.com/Tony-sama/SillyTavern-Content/main/index.json" let availableAssets = {}; let currentAssets = {}; //#############################// // Extension UI and Settings // //#############################// const defaultSettings = { } function downloadAssetsList(url) { updateCurrentAssets().then(function () { fetch(url) .then(response => response.json()) .then(json => { availableAssets = {}; $("#assets_menu").empty(); console.debug(DEBUG_PREFIX, "Received assets dictionary", json); for (const i of json) { //console.log(DEBUG_PREFIX,i) if (availableAssets[i["type"]] === undefined) availableAssets[i["type"]] = []; availableAssets[i["type"]].push(i); } console.debug(DEBUG_PREFIX, "Updated available assets to", availableAssets); for (const assetType in availableAssets) { let assetTypeMenu = $('
', { id: "assets_audio_ambient_div", class: "assets-list-div" }); assetTypeMenu.append(`

${assetType}

`) for (const i in availableAssets[assetType]) { const asset = availableAssets[assetType][i]; const elemId = `assets_install_${assetType}_${i}`; let element = $('