Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/extensions/extension.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import {
const { user, repo, branch, filePath } = getParamsFromGithubRaw(extensionManifest.extensionURL);
if (!user || !repo || !branch || !filePath) return;
script.src = `https://cdn.jsdelivr.${tld}/gh/${user}/${repo}@${branch}/${filePath}`;
if (filePath.endsWith(".mjs")) script.type = "module";
}

script.src = `${script.src}?time=${Date.now()}`;
Expand All @@ -93,6 +94,7 @@ import {
injectColourScheme(activeScheme);

// Add to Spicetify.Config
// @ts-expect-error: `color_scheme` is read-only type in types
Spicetify.Config.color_scheme = themeManifest.activeScheme;
if (localStorage.getItem(LOCALSTORAGE_KEYS.albumArtBasedColor) === "true") {
initAlbumArtBasedColor(activeScheme);
Expand All @@ -117,6 +119,7 @@ import {
injectUserCSS(userCSS);

// Add to Spicetify.Config
// @ts-expect-error: `current_theme` is read-only type in types
Spicetify.Config.current_theme = themeManifest.manifest?.name;

// Inject any included js
Expand All @@ -130,7 +133,9 @@ import {
// If it's a github raw script, use jsdelivr
if (isGithubRawUrl(script)) {
const { user, repo, branch, filePath } = getParamsFromGithubRaw(script);
if (!user || !repo || !branch || !filePath) return;
src = `https://cdn.jsdelivr.${tld}/gh/${user}/${repo}@${branch}/${filePath}`;
if (filePath.endsWith(".mjs")) newScript.type = "module";
}
// console.log({src});
newScript.src = `${src}?time=${Date.now()}`;
Expand Down Expand Up @@ -164,7 +169,9 @@ import {
window.sessionStorage.setItem("marketplace-request-tld", tld);

// Save to Spicetify.Config for use when removing a theme
// @ts-expect-error: Config doesn't have a `local_theme` property
Spicetify.Config.local_theme = Spicetify.Config.current_theme;
// @ts-expect-error: Config doesn't have a `local_color_scheme` property
Spicetify.Config.local_color_scheme = Spicetify.Config.color_scheme;
const installedThemeKey = localStorage.getItem(LOCALSTORAGE_KEYS.themeInstalled);
if (installedThemeKey) initializeTheme(installedThemeKey);
Expand Down