Fix background embedding
This commit is contained in:
@@ -2,16 +2,16 @@
|
|||||||
import { ParseMarkdown, risuChatParser } from "src/ts/parser.svelte";
|
import { ParseMarkdown, risuChatParser } from "src/ts/parser.svelte";
|
||||||
import { type character, type groupChat } from "src/ts/storage/database.svelte";
|
import { type character, type groupChat } from "src/ts/storage/database.svelte";
|
||||||
import { DBState } from 'src/ts/stores.svelte';
|
import { DBState } from 'src/ts/stores.svelte';
|
||||||
import { moduleBackgroundEmbedding, ReloadGUIPointer, selectedCharID } from "src/ts/stores.svelte";
|
import { moduleBackgroundEmbedding, ReloadGUIPointer, selIdState } from "src/ts/stores.svelte";
|
||||||
|
|
||||||
let backgroundHTML = $derived(DBState.db?.characters?.[$selectedCharID]?.backgroundHTML)
|
let backgroundHTML = $derived(DBState.db?.characters?.[selIdState.selId]?.backgroundHTML)
|
||||||
let currentChar:character|groupChat = $state()
|
let currentChar:character|groupChat = $state()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
||||||
{#if backgroundHTML || $moduleBackgroundEmbedding}
|
{#if backgroundHTML || $moduleBackgroundEmbedding}
|
||||||
{#if $selectedCharID > -1}
|
{#if selIdState.selId > -1}
|
||||||
{#key $ReloadGUIPointer}
|
{#key $ReloadGUIPointer}
|
||||||
<div class="absolute top-0 left-0 w-full h-full">
|
<div class="absolute top-0 left-0 w-full h-full">
|
||||||
{#await ParseMarkdown(risuChatParser((backgroundHTML || '') + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
|
{#await ParseMarkdown(risuChatParser((backgroundHTML || '') + ($moduleBackgroundEmbedding || ''), {chara:currentChar}), currentChar, 'back') then md}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { convertExternalLorebook } from "./lorebook.svelte"
|
|||||||
import { decodeRPack, encodeRPack } from "../rpack/rpack_bg"
|
import { decodeRPack, encodeRPack } from "../rpack/rpack_bg"
|
||||||
import { convertImage } from "../parser.svelte"
|
import { convertImage } from "../parser.svelte"
|
||||||
import { Capacitor } from "@capacitor/core"
|
import { Capacitor } from "@capacitor/core"
|
||||||
import { HideIconStore, moduleBackgroundEmbedding } from "../stores.svelte"
|
import { DBState, HideIconStore, moduleBackgroundEmbedding } from "../stores.svelte"
|
||||||
|
|
||||||
export interface RisuModule{
|
export interface RisuModule{
|
||||||
name: string
|
name: string
|
||||||
@@ -397,7 +397,6 @@ export async function applyModule() {
|
|||||||
|
|
||||||
let lastGlobalEnabledModules: string[] = []
|
let lastGlobalEnabledModules: string[] = []
|
||||||
let lastChatEnabledModules: string[] = []
|
let lastChatEnabledModules: string[] = []
|
||||||
let characterHideIcon = false
|
|
||||||
|
|
||||||
export function moduleUpdate(){
|
export function moduleUpdate(){
|
||||||
if(!Array.isArray(lastGlobalEnabledModules)){
|
if(!Array.isArray(lastGlobalEnabledModules)){
|
||||||
@@ -425,7 +424,10 @@ export function moduleUpdate(){
|
|||||||
})
|
})
|
||||||
|
|
||||||
if(backgroundEmbedding){
|
if(backgroundEmbedding){
|
||||||
|
console.log('Background Embedding:', backgroundEmbedding)
|
||||||
moduleBackgroundEmbedding.set(backgroundEmbedding)
|
moduleBackgroundEmbedding.set(backgroundEmbedding)
|
||||||
}
|
}
|
||||||
HideIconStore.set(characterHideIcon || moduleHideIcon)
|
console.log('Module Hide Icon:', moduleHideIcon)
|
||||||
|
console.log(Date.now())
|
||||||
|
HideIconStore.set(getCurrentCharacter()?.hideChatIcon || moduleHideIcon)
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,10 @@ export const alertStore = writable({
|
|||||||
type: 'none',
|
type: 'none',
|
||||||
msg: 'n',
|
msg: 'n',
|
||||||
} as alertData)
|
} as alertData)
|
||||||
|
export const selIdState = $state({
|
||||||
|
selId: -1
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
CustomCSSStore.subscribe((css) => {
|
CustomCSSStore.subscribe((css) => {
|
||||||
console.log(css)
|
console.log(css)
|
||||||
@@ -91,18 +95,16 @@ export const DBState = $state({
|
|||||||
|
|
||||||
export const disableHighlight = writable(true)
|
export const disableHighlight = writable(true)
|
||||||
|
|
||||||
let selIdState = $state(0)
|
|
||||||
|
|
||||||
selectedCharID.subscribe((v) => {
|
|
||||||
selIdState = v
|
|
||||||
})
|
|
||||||
|
|
||||||
$effect.root(() => {
|
$effect.root(() => {
|
||||||
|
selectedCharID.subscribe((v) => {
|
||||||
|
selIdState.selId = v
|
||||||
|
})
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
$state.snapshot(DBState.db.modules)
|
$state.snapshot(DBState.db.modules)
|
||||||
DBState?.db?.enabledModules
|
DBState?.db?.enabledModules
|
||||||
DBState?.db?.enabledModules?.length
|
DBState?.db?.enabledModules?.length
|
||||||
DBState?.db?.characters?.[selIdState]?.chats?.[DBState?.db?.characters?.[selIdState]?.chatPage]?.modules?.length
|
DBState?.db?.characters?.[selIdState.selId]?.chats?.[DBState?.db?.characters?.[selIdState.selId]?.chatPage]?.modules?.length
|
||||||
|
DBState?.db?.characters?.[selIdState.selId]?.hideChatIcon
|
||||||
DBState?.db?.moduleIntergration
|
DBState?.db?.moduleIntergration
|
||||||
ReloadGUIPointer.set(get(ReloadGUIPointer) + 1)
|
ReloadGUIPointer.set(get(ReloadGUIPointer) + 1)
|
||||||
moduleUpdate()
|
moduleUpdate()
|
||||||
|
|||||||
Reference in New Issue
Block a user