beta features

This commit is contained in:
Andras Bacsai 2022-05-02 09:43:38 +02:00
parent 3e9cf7285b
commit 1905db16e8
3 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import { writable, type Writable } from 'svelte/store'; import { writable, type Writable, type Readable, readable } from 'svelte/store';
export const gitTokens: Writable<{ githubToken: string | null; gitlabToken: string | null }> = export const gitTokens: Writable<{ githubToken: string | null; gitlabToken: string | null }> =
writable({ writable({
@ -6,3 +6,8 @@ export const gitTokens: Writable<{ githubToken: string | null; gitlabToken: stri
gitlabToken: null gitlabToken: null
}); });
export const disabledButton: Writable<boolean> = writable(false); export const disabledButton: Writable<boolean> = writable(false);
export const features: Readable<{ latestVersion: string; beta: boolean }> = readable({
beta: window.localStorage.getItem('beta') === 'true',
latestVersion: window.localStorage.getItem('latestVersion')
});

View File

@ -41,7 +41,8 @@
import { errorNotification } from '$lib/form'; import { errorNotification } from '$lib/form';
import { asyncSleep } from '$lib/components/common'; import { asyncSleep } from '$lib/components/common';
import { del, get, post } from '$lib/api'; import { del, get, post } from '$lib/api';
import { browser, dev } from '$app/env'; import { dev } from '$app/env';
import { features } from '$lib/store';
let isUpdateAvailable = false; let isUpdateAvailable = false;
let updateStatus = { let updateStatus = {
@ -52,7 +53,7 @@
let latestVersion = 'latest'; let latestVersion = 'latest';
onMount(async () => { onMount(async () => {
if ($session.userId) { if ($session.userId) {
const overrideVersion = browser && window.localStorage.getItem('latestVersion'); const overrideVersion = $features.latestVersion;
try { try {
await get(`/login.json`); await get(`/login.json`);
} catch ({ error }) { } catch ({ error }) {

View File

@ -28,8 +28,6 @@
import { session } from '$app/stores'; import { session } from '$app/stores';
export let settings; export let settings;
import Cookies from 'js-cookie';
import langs from '$lib/lang.json';
import Setting from '$lib/components/Setting.svelte'; import Setting from '$lib/components/Setting.svelte';
import Explainer from '$lib/components/Explainer.svelte'; import Explainer from '$lib/components/Explainer.svelte';
import { errorNotification } from '$lib/form'; import { errorNotification } from '$lib/form';
@ -39,6 +37,7 @@
import { getDomain } from '$lib/components/common'; import { getDomain } from '$lib/components/common';
import { toast } from '@zerodevx/svelte-toast'; import { toast } from '@zerodevx/svelte-toast';
import { t } from '$lib/translations'; import { t } from '$lib/translations';
import { features } from '$lib/store';
let isRegistrationEnabled = settings.isRegistrationEnabled; let isRegistrationEnabled = settings.isRegistrationEnabled;
let dualCerts = settings.dualCerts; let dualCerts = settings.dualCerts;
@ -211,7 +210,7 @@
on:click={() => changeSettings('isRegistrationEnabled')} on:click={() => changeSettings('isRegistrationEnabled')}
/> />
</div> </div>
{#if browser && (window.location.hostname === 'staging.coolify.io' || window.location.hostname === 'localhost')} {#if browser && $features.beta}
<div class="grid grid-cols-2 items-center"> <div class="grid grid-cols-2 items-center">
<Setting <Setting
bind:setting={isAutoUpdateEnabled} bind:setting={isAutoUpdateEnabled}