mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 11:44:40 +00:00
separate installtheme logic
This commit is contained in:
@@ -21,6 +21,10 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
|
|||||||
const themeContent = await fetch(`https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes/${theme.themeContent.id}/theme.json`);
|
const themeContent = await fetch(`https://raw.githubusercontent.com/BetterSEQTA/BetterSEQTA-Themes/main/store/themes/${theme.themeContent.id}/theme.json`);
|
||||||
const themeData = await themeContent.json() as ThemeContent;
|
const themeData = await themeContent.json() as ThemeContent;
|
||||||
|
|
||||||
|
await InstallTheme(themeData);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const InstallTheme = async (themeData: ThemeContent) => {
|
||||||
const coverImageBlob = base64ToBlob(themeData.coverImage);
|
const coverImageBlob = base64ToBlob(themeData.coverImage);
|
||||||
|
|
||||||
const images = themeData.images.map((image) => ({
|
const images = themeData.images.map((image) => ({
|
||||||
@@ -38,7 +42,7 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
|
|||||||
|
|
||||||
await localforage.setItem(themeData.id, {
|
await localforage.setItem(themeData.id, {
|
||||||
...themeData,
|
...themeData,
|
||||||
webURL: theme.themeContent.id,
|
webURL: themeData.id,
|
||||||
coverImage: coverImageBlob,
|
coverImage: coverImageBlob,
|
||||||
CustomImages: themeData.images.map((image) => {
|
CustomImages: themeData.images.map((image) => {
|
||||||
return {
|
return {
|
||||||
@@ -47,6 +51,4 @@ export const StoreDownloadTheme = async (theme: { themeContent: Theme }) => {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default StoreDownloadTheme;
|
|
||||||
Reference in New Issue
Block a user