Merge remote-tracking branch 'upstream/dev' into feat/oauth

This commit is contained in:
Jun Siang Cheah
2024-06-24 18:46:48 +08:00
81 changed files with 4112 additions and 1214 deletions

View File

@@ -29,13 +29,15 @@
showChangelog,
config,
showCallOverlay,
tools
tools,
functions
} from '$lib/stores';
import SettingsModal from '$lib/components/chat/SettingsModal.svelte';
import Sidebar from '$lib/components/layout/Sidebar.svelte';
import ChangelogModal from '$lib/components/ChangelogModal.svelte';
import AccountPending from '$lib/components/layout/Overlay/AccountPending.svelte';
import { getFunctions } from '$lib/apis/functions';
const i18n = getContext('i18n');
@@ -93,6 +95,9 @@
(async () => {
tools.set(await getTools(localStorage.token));
})(),
(async () => {
functions.set(await getFunctions(localStorage.token));
})(),
(async () => {
banners.set(await getBanners(localStorage.token));
})(),

View File

@@ -1,7 +1,7 @@
<script>
import { showSidebar } from '$lib/stores';
import Playground from '$lib/components/workspace/Playground.svelte';
import Playground from '$lib/components/playground/Playground.svelte';
</script>
<div

View File

@@ -9,7 +9,7 @@
const i18n = getContext('i18n');
onMount(async () => {
functions.set(await getFunctions(localStorage.token));
// functions.set(await getFunctions(localStorage.token));
});
</script>

View File

@@ -37,6 +37,8 @@
let loaded = false;
const BREAKPOINT = 768;
let wakeLock = null;
onMount(async () => {
theme.set(localStorage.theme);
@@ -51,6 +53,31 @@
window.addEventListener('resize', onResize);
const setWakeLock = async () => {
try {
wakeLock = await navigator.wakeLock.request('screen');
} catch (err) {
// The Wake Lock request has failed - usually system related, such as battery.
console.log(err);
}
wakeLock.addEventListener('release', () => {
// the wake lock has been released
console.log('Wake Lock released');
});
};
if ('wakeLock' in navigator) {
await setWakeLock();
document.addEventListener('visibilitychange', async () => {
// Re-request the wake lock if the document becomes visible
if (wakeLock !== null && document.visibilityState === 'visible') {
await setWakeLock();
}
});
}
let backendConfig = null;
try {
backendConfig = await getBackendConfig();