feat(client/server): basic support for experimental features

This commit is contained in:
Elian Doran 2025-12-09 19:34:03 +02:00
parent 1ceed1b47b
commit ae154212fe
No known key found for this signature in database
5 changed files with 44 additions and 7 deletions

View File

@ -0,0 +1,13 @@
interface ExperimentalFeature {
id: string;
name: string;
description: string;
}
export const experimentalFeatures: ExperimentalFeature[] = [
{
id: "newLayout",
name: "New Layout",
description: "Try out the new layout for a more modern look and improved usability.",
}
];

View File

@ -7,6 +7,9 @@ import FormText from "../../react/FormText";
import OptionsSection from "./components/OptionsSection"
import Column from "../../react/Column";
import { useEffect, useState } from "preact/hooks";
import CheckboxList from "./components/CheckboxList";
import { experimentalFeatures } from "../../../services/experimental_features";
import { useTriliumOptionJson } from "../../react/hooks";
export default function AdvancedSettings() {
return <>
@ -14,6 +17,7 @@ export default function AdvancedSettings() {
<DatabaseIntegrityOptions />
<DatabaseAnonymizationOptions />
<VacuumDatabaseOptions />
<ExperimentalOptions />
</>;
}
@ -173,3 +177,20 @@ function VacuumDatabaseOptions() {
</OptionsSection>
)
}
function ExperimentalOptions() {
const [ enabledExperimentalFeatures, setEnabledExperimentalFeatures ] = useTriliumOptionJson<string[]>("experimentalFeatures");
return (
<OptionsSection title="Experimental Options">
<FormText>These options are experimental and may cause instability. Use with caution.</FormText>
<CheckboxList
values={experimentalFeatures}
keyProperty="id"
titleProperty="name"
currentValue={enabledExperimentalFeatures} onChange={setEnabledExperimentalFeatures}
/>
</OptionsSection>
)
}

View File

@ -99,6 +99,7 @@ const ALLOWED_OPTIONS = new Set<OptionNames>([
"showLoginInShareTheme",
"splitEditorOrientation",
"seenCallToActions",
"experimentalFeatures",
// AI/LLM integration options
"aiEnabled",

View File

@ -215,7 +215,8 @@ const defaultOptions: DefaultOption[] = [
{ name: "aiSystemPrompt", value: "", isSynced: true },
{ name: "aiSelectedProvider", value: "openai", isSynced: true },
{ name: "seenCallToActions", value: "[]", isSynced: true }
{ name: "seenCallToActions", value: "[]", isSynced: true },
{ name: "experimentalFeatures", value: "[]", isSynced: true }
];
/**

View File

@ -155,6 +155,7 @@ export interface OptionDefinitions extends KeyboardShortcutsOptions<KeyboardActi
codeOpenAiModel: string;
aiSelectedProvider: string;
seenCallToActions: string;
experimentalFeatures: string;
}
export type OptionNames = keyof OptionDefinitions;