diff --git a/.gitignore b/.gitignore index 5de9503f..cb2329d5 100644 --- a/.gitignore +++ b/.gitignore @@ -41,4 +41,5 @@ recc.md __pycache__/ .tauri/ dist.zip -scripts/ \ No newline at end of file +scripts/ +.env \ No newline at end of file diff --git a/src/App.svelte b/src/App.svelte index 7332c8ab..9efe1fb5 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -13,6 +13,8 @@ import RealmFrame from './lib/UI/Realm/RealmFrame.svelte'; import { AccountWarning } from './ts/storage/accountStorage'; import AccountWarningComp from './lib/Others/AccountWarningComp.svelte'; + import { isLite } from './ts/lite'; + import LiteMain from './LiteMain.svelte'; let didFirstSetup: boolean = false let gridOpen = false @@ -36,8 +38,11 @@ {:else if !didFirstSetup} + {:else if $isLite} + {:else if $settingsOpen} + {:else} {#if gridOpen} {gridOpen = false}} /> diff --git a/src/LiteMain.svelte b/src/LiteMain.svelte new file mode 100644 index 00000000..af8c0c9b --- /dev/null +++ b/src/LiteMain.svelte @@ -0,0 +1,51 @@ + + +
+
+
+

+ Lite Test +

+ +
+
+ {#if $selectedCharID === -1} +
+
+ {#await getRisuHub({ + search: '', + page: 0, + nsfw: false, + sort: '' + })} + 로딩중... + {:then cards} + {#each cards as card} + { + await downloadRisuHub(card.id, { + forceRedirect: true + }) + }} /> + {/each} + {/await} +
+
+ {:else} +
+
+ +
+
+ {/if} +
diff --git a/src/lib/ChatScreens/Chat.svelte b/src/lib/ChatScreens/Chat.svelte index 89f1cb2b..03e3b18f 100644 --- a/src/lib/ChatScreens/Chat.svelte +++ b/src/lib/ChatScreens/Chat.svelte @@ -180,7 +180,7 @@ }}> {:else if !blankMessage && !$HideIconStore} - {name} + {name} {/if}
{statusMessage} diff --git a/src/lib/LiteUI/LiteCardIcon.svelte b/src/lib/LiteUI/LiteCardIcon.svelte new file mode 100644 index 00000000..702efb99 --- /dev/null +++ b/src/lib/LiteUI/LiteCardIcon.svelte @@ -0,0 +1,28 @@ + + + + {/if} + {/each} +
+ + \ No newline at end of file diff --git a/src/ts/alert.ts b/src/ts/alert.ts index 7d24f0a8..25abb1d2 100644 --- a/src/ts/alert.ts +++ b/src/ts/alert.ts @@ -246,9 +246,9 @@ export async function alertCardExport(type:string = ''){ export async function alertTOS(){ - // if(localStorage.getItem('tos') === 'true'){ - // return true - // } + if(localStorage.getItem('tos') === 'true'){ + return true + } alertStore.set({ 'type': 'tos', diff --git a/src/ts/characterCards.ts b/src/ts/characterCards.ts index 4715baae..ffe37d8e 100644 --- a/src/ts/characterCards.ts +++ b/src/ts/characterCards.ts @@ -1264,6 +1264,7 @@ export type hubType = { authorname?:string original?:string type:string + hidden?:boolean } export let hubAdditionalHTML = '' @@ -1293,15 +1294,19 @@ export async function getRisuHub(arg:{ } } -export async function downloadRisuHub(id:string) { +export async function downloadRisuHub(id:string, arg:{ + forceRedirect?: boolean +} = {}) { try { - if(!(await alertTOS())){ - return + if(!arg.forceRedirect){ + if(!(await alertTOS())){ + return + } + alertStore.set({ + type: "wait", + msg: "Downloading..." + }) } - alertStore.set({ - type: "wait", - msg: "Downloading..." - }) const res = await fetch("https://realm.risuai.net/api/v1/download/png-v3/" + id + '?cors=true', { headers: { "x-risu-api-version": "4" @@ -1319,7 +1324,7 @@ export async function downloadRisuHub(id:string) { }) checkCharOrder() let db = get(DataBase) - if(db.characters[db.characters.length-1] && db.goCharacterOnImport){ + if(db.characters[db.characters.length-1] && (db.goCharacterOnImport || arg.forceRedirect)){ const index = db.characters.length-1 characterFormatUpdate(index); selectedCharID.set(index); @@ -1328,17 +1333,23 @@ export async function downloadRisuHub(id:string) { } const result = await res.json() - const data:CharacterCardV2Risu = result.card + const data:CharacterCardV3 = result.card const img:string = result.img + + data.data.extensions.risuRealmImportId = id await importCharacterCardSpec(data, await getHubResources(img), 'hub') checkCharOrder() let db = get(DataBase) - if(db.characters[db.characters.length-1] && db.goCharacterOnImport){ + if(db.characters[db.characters.length-1] && (db.goCharacterOnImport || arg.forceRedirect)){ const index = db.characters.length-1 characterFormatUpdate(index); selectedCharID.set(index); - } + alertStore.set({ + type: 'none', + msg: '' + }) + } } catch (error) { console.error(error) alertError("Error while importing") diff --git a/src/ts/gui/colorscheme.ts b/src/ts/gui/colorscheme.ts index fdafea1c..790147e9 100644 --- a/src/ts/gui/colorscheme.ts +++ b/src/ts/gui/colorscheme.ts @@ -3,6 +3,7 @@ import { DataBase, setDatabase } from "../storage/database"; import { downloadFile } from "../storage/globalApi"; import { BufferToText, selectSingleFile } from "../util"; import { alertError } from "../alert"; +import { isLite } from "../lite"; export interface ColorScheme{ bgcolor: string; @@ -119,6 +120,10 @@ export function updateColorScheme(){ colorScheme = structuredClone(defaultColorScheme) } + if(get(isLite)){ + colorScheme = structuredClone(colorShemes.light) + } + //set css variables document.documentElement.style.setProperty("--risu-theme-bgcolor", colorScheme.bgcolor); document.documentElement.style.setProperty("--risu-theme-darkbg", colorScheme.darkbg); @@ -180,9 +185,11 @@ export function updateTextTheme(){ if(!root){ return } - switch(db.textTheme){ + let textTheme = get(isLite) ? 'standard' : db.textTheme + let colorScheme = get(isLite) ? 'light' : db.colorScheme.type + switch(textTheme){ case "standard":{ - if(db.colorScheme.type === 'dark'){ + if(colorScheme === 'dark'){ root.style.setProperty('--FontColorStandard', '#fafafa'); root.style.setProperty('--FontColorItalic', '#8C8D93'); root.style.setProperty('--FontColorBold', '#fafafa'); @@ -200,7 +207,7 @@ export function updateTextTheme(){ break } case "highcontrast":{ - if(db.colorScheme.type === 'dark'){ + if(colorScheme === 'dark'){ root.style.setProperty('--FontColorStandard', '#f8f8f2'); root.style.setProperty('--FontColorItalic', '#F1FA8C'); root.style.setProperty('--FontColorBold', '#8BE9FD'); diff --git a/src/ts/lite.ts b/src/ts/lite.ts new file mode 100644 index 00000000..301ecbb8 --- /dev/null +++ b/src/ts/lite.ts @@ -0,0 +1,6 @@ +import { writable } from "svelte/store"; + +if(import.meta.env.DEV){ + console.log(`Lite Mode: ${import.meta.env.VITE_RISU_LITE}`) +} +export const isLite = writable(import.meta.env.VITE_RISU_LITE === 'TRUE') \ No newline at end of file