Add TOS alert

This commit is contained in:
kwaroran
2024-08-26 17:20:54 +09:00
parent b9721b80c5
commit f7ddc09277
3 changed files with 13 additions and 6 deletions

View File

@@ -80,7 +80,7 @@
{:else if $alertStore.type === 'tos'} {:else if $alertStore.type === 'tos'}
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y-missing-attribute -->
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<div class="text-textcolor">You should accept RisuRealm's <a class="text-green-600 hover:text-green-500 transition-colors duration-200 cursor-pointer" on:click={() => { <div class="text-textcolor">You should accept <a class="text-green-600 hover:text-green-500 transition-colors duration-200 cursor-pointer" on:click={() => {
openURL('https://sv.risuai.xyz/hub/tos') openURL('https://sv.risuai.xyz/hub/tos')
}}>Terms of Service</a> to continue</div> }}>Terms of Service</a> to continue</div>
{:else if $alertStore.type !== 'select' && $alertStore.type !== 'requestdata' && $alertStore.type !== 'addchar' && $alertStore.type !== 'hypaV2' && $alertStore.type !== 'chatOptions'} {:else if $alertStore.type !== 'select' && $alertStore.type !== 'requestdata' && $alertStore.type !== 'addchar' && $alertStore.type !== 'hypaV2' && $alertStore.type !== 'chatOptions'}
@@ -112,7 +112,7 @@
msg: 'yes' msg: 'yes'
}) })
}}>Accept</Button> }}>Accept</Button>
<Button className="mt-4 flex-grow" on:click={() => { <Button styled={'outlined'} className="mt-4 flex-grow" on:click={() => {
alertStore.set({ alertStore.set({
type: 'none', type: 'none',
msg: 'no' msg: 'no'

View File

@@ -246,7 +246,7 @@ export async function alertCardExport(type:string = ''){
export async function alertTOS(){ export async function alertTOS(){
if(localStorage.getItem('tos') === 'true'){ if(localStorage.getItem('tos2') === 'true'){
return true return true
} }
@@ -263,7 +263,7 @@ export async function alertTOS(){
} }
if(get(alertStore).msg === 'yes'){ if(get(alertStore).msg === 'yes'){
localStorage.setItem('tos', 'true') localStorage.setItem('tos2', 'true')
return true return true
} }

View File

@@ -12,7 +12,7 @@ import { checkRisuUpdate } from "../update";
import { botMakerMode, selectedCharID } from "../stores"; import { botMakerMode, selectedCharID } from "../stores";
import { Body, ResponseType, fetch as TauriFetch } from "@tauri-apps/api/http"; import { Body, ResponseType, fetch as TauriFetch } from "@tauri-apps/api/http";
import { loadPlugins } from "../plugins/plugins"; import { loadPlugins } from "../plugins/plugins";
import { alertConfirm, alertError, alertNormal, alertNormalWait, alertSelect } from "../alert"; import { alertConfirm, alertError, alertNormal, alertNormalWait, alertSelect, alertTOS } from "../alert";
import { checkDriverInit, syncDrive } from "../drive/drive"; import { checkDriverInit, syncDrive } from "../drive/drive";
import { hasher } from "../parser"; import { hasher } from "../parser";
import { characterURLImport, hubURL } from "../characterCards"; import { characterURLImport, hubURL } from "../characterCards";
@@ -536,7 +536,14 @@ export async function loadData() {
loadedStore.set(true) loadedStore.set(true)
selectedCharID.set(-1) selectedCharID.set(-1)
startObserveDom() startObserveDom()
saveDb() saveDb()
if(import.meta.env.VITE_RISU_TOS === 'TRUE'){
alertTOS().then((a) => {
if(a === false){
location.reload()
}
})
}
} catch (error) { } catch (error) {
alertError(`${error}`) alertError(`${error}`)
} }