mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
Fixing: Some getConfigs where breaking in new system (#2685)
This commit is contained in:
@@ -0,0 +1,127 @@
|
||||
export default {
|
||||
homepage: {
|
||||
name: "Homepage",
|
||||
description:
|
||||
"The page that will be displayed when your Start9 Pages .onion address is visited. Since this page is technically publicly accessible, you can choose to which type of page to display.",
|
||||
type: "union",
|
||||
default: "welcome",
|
||||
tag: {
|
||||
id: "type",
|
||||
name: "Type",
|
||||
"variant-names": {
|
||||
welcome: "Welcome",
|
||||
index: "Table of Contents",
|
||||
"web-page": "Web Page",
|
||||
redirect: "Redirect",
|
||||
},
|
||||
},
|
||||
variants: {
|
||||
welcome: {},
|
||||
index: {},
|
||||
"web-page": {
|
||||
source: {
|
||||
name: "Folder Location",
|
||||
description: "The service that contains your website files.",
|
||||
type: "enum",
|
||||
values: ["filebrowser", "nextcloud"],
|
||||
"value-names": {},
|
||||
default: "nextcloud",
|
||||
},
|
||||
folder: {
|
||||
type: "string",
|
||||
name: "Folder Path",
|
||||
placeholder: "e.g. websites/resume",
|
||||
description:
|
||||
'The path to the folder that contains the static files of your website. For example, a value of "projects/resume" would tell Start9 Pages to look for that folder path in the selected service.',
|
||||
pattern:
|
||||
"^(\\.|[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)(/[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|/([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)*/?$",
|
||||
"pattern-description": "Must be a valid relative file path",
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
redirect: {
|
||||
target: {
|
||||
type: "string",
|
||||
name: "Target Subdomain",
|
||||
description:
|
||||
"The name of the subdomain to redirect users to. This must be a valid subdomain site within your Start9 Pages.",
|
||||
pattern: "^[a-z-]+$",
|
||||
"pattern-description":
|
||||
"May contain only lowercase characters and hyphens.",
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
subdomains: {
|
||||
type: "list",
|
||||
name: "Subdomains",
|
||||
description: "The websites you want to serve.",
|
||||
default: [],
|
||||
range: "[0, *)",
|
||||
subtype: "object",
|
||||
spec: {
|
||||
"unique-by": "name",
|
||||
"display-as": "{{name}}",
|
||||
spec: {
|
||||
name: {
|
||||
type: "string",
|
||||
nullable: false,
|
||||
name: "Subdomain name",
|
||||
description:
|
||||
'The subdomain of your Start9 Pages .onion address to host the website on. For example, a value of "me" would produce a website hosted at http://me.xxxxxx.onion.',
|
||||
pattern: "^[a-z-]+$",
|
||||
"pattern-description":
|
||||
"May contain only lowercase characters and hyphens",
|
||||
},
|
||||
settings: {
|
||||
type: "union",
|
||||
name: "Settings",
|
||||
description:
|
||||
"The desired behavior you want to occur when the subdomain is visited. You can either redirect to another subdomain, or load a stored web page.",
|
||||
default: "web-page",
|
||||
tag: {
|
||||
id: "type",
|
||||
name: "Type",
|
||||
"variant-names": { "web-page": "Web Page", redirect: "Redirect" },
|
||||
},
|
||||
variants: {
|
||||
"web-page": {
|
||||
source: {
|
||||
name: "Folder Location",
|
||||
description: "The service that contains your website files.",
|
||||
type: "enum",
|
||||
values: ["filebrowser", "nextcloud"],
|
||||
"value-names": {},
|
||||
default: "nextcloud",
|
||||
},
|
||||
folder: {
|
||||
type: "string",
|
||||
name: "Folder Path",
|
||||
placeholder: "e.g. websites/resume",
|
||||
description:
|
||||
'The path to the folder that contains the website files. For example, a value of "projects/resume" would tell Start9 Pages to look for that folder path in the selected service.',
|
||||
pattern:
|
||||
"^(\\.|[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)(/[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|/([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)*/?$",
|
||||
"pattern-description": "Must be a valid relative file path",
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
redirect: {
|
||||
target: {
|
||||
type: "string",
|
||||
name: "Target Subdomain",
|
||||
description:
|
||||
"The subdomain of your Start9 Pages .onion address to redirect to. This should be the name of another subdomain on Start9 Pages. Leave empty to redirect to the homepage.",
|
||||
pattern: "^[a-z-]+$",
|
||||
"pattern-description":
|
||||
"May contain only lowercase characters and hyphens.",
|
||||
nullable: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
export default {
|
||||
"instance-name": {
|
||||
type: "string",
|
||||
name: "SearXNG Instance Name",
|
||||
description:
|
||||
"Enter a name for your SearXNG instance. This is the name that will be listed if you want to share your SearXNG engine publicly.",
|
||||
nullable: false,
|
||||
default: "My SearXNG Engine",
|
||||
placeholder: "Uncle Jim SearXNG Engine",
|
||||
},
|
||||
"tor-url": {
|
||||
name: "Enable Tor address as the base URL",
|
||||
description:
|
||||
"Activates the utilization of a .onion address as the primary URL, particularly beneficial for publicly hosted instances over the Tor network.",
|
||||
type: "boolean",
|
||||
default: false,
|
||||
},
|
||||
"enable-metrics": {
|
||||
name: "Enable Stats",
|
||||
description:
|
||||
"Your SearXNG instance will collect anonymous stats about its own usage and performance. You can view these metrics by appending `/stats` or `/stats/errors` to your SearXNG URL.",
|
||||
type: "boolean",
|
||||
default: true,
|
||||
}, //,
|
||||
// "email-address": {
|
||||
// "type": "string",
|
||||
// "name": "Email Address",
|
||||
// "description": "Your Email address - required to create an SSL certificate.",
|
||||
// "nullable": false,
|
||||
// "default": "youremail@domain.com",
|
||||
// },
|
||||
// "public-host": {
|
||||
// "type": "string",
|
||||
// "name": "Public Domain Name",
|
||||
// "description": "Enter a domain name here if you want to share your SearXNG engine publicly. You will also need to modify your domain name's DNS settings to point to your Start9 server.",
|
||||
// "nullable": true,
|
||||
// "placeholder": "https://search.mydomain.com"
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,253 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`transformConfigSpec transformConfigSpec(embassyPages) 1`] = `
|
||||
{
|
||||
"homepage": {
|
||||
"default": "welcome",
|
||||
"description": null,
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Type",
|
||||
"required": true,
|
||||
"type": "union",
|
||||
"variants": {
|
||||
"index": {
|
||||
"name": "Table of Contents",
|
||||
"spec": {},
|
||||
},
|
||||
"redirect": {
|
||||
"name": "Redirect",
|
||||
"spec": {
|
||||
"target": {
|
||||
"default": null,
|
||||
"description": "The name of the subdomain to redirect users to. This must be a valid subdomain site within your Start9 Pages.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Target Subdomain",
|
||||
"patterns": [
|
||||
{
|
||||
"description": "May contain only lowercase characters and hyphens.",
|
||||
"regex": "^[a-z-]+$",
|
||||
},
|
||||
],
|
||||
"placeholder": null,
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
},
|
||||
},
|
||||
"web-page": {
|
||||
"name": "Web Page",
|
||||
"spec": {
|
||||
"folder": {
|
||||
"default": null,
|
||||
"description": "The path to the folder that contains the static files of your website. For example, a value of "projects/resume" would tell Start9 Pages to look for that folder path in the selected service.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Folder Path",
|
||||
"patterns": [
|
||||
{
|
||||
"description": "Must be a valid relative file path",
|
||||
"regex": "^(\\.|[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)(/[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|/([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)*/?$",
|
||||
},
|
||||
],
|
||||
"placeholder": "e.g. websites/resume",
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
"source": {
|
||||
"default": "nextcloud",
|
||||
"description": "The service that contains your website files.",
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Folder Location",
|
||||
"required": false,
|
||||
"type": "select",
|
||||
"values": {
|
||||
"filebrowser": undefined,
|
||||
"nextcloud": undefined,
|
||||
},
|
||||
"warning": null,
|
||||
},
|
||||
},
|
||||
},
|
||||
"welcome": {
|
||||
"name": "Welcome",
|
||||
"spec": {},
|
||||
},
|
||||
},
|
||||
"warning": null,
|
||||
},
|
||||
"subdomains": {
|
||||
"default": [],
|
||||
"description": "The websites you want to serve.",
|
||||
"disabled": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Subdomains",
|
||||
"spec": {
|
||||
"displayAs": "{{name}}",
|
||||
"spec": {
|
||||
"name": {
|
||||
"default": null,
|
||||
"description": "The subdomain of your Start9 Pages .onion address to host the website on. For example, a value of "me" would produce a website hosted at http://me.xxxxxx.onion.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Subdomain name",
|
||||
"patterns": [
|
||||
{
|
||||
"description": "May contain only lowercase characters and hyphens",
|
||||
"regex": "^[a-z-]+$",
|
||||
},
|
||||
],
|
||||
"placeholder": null,
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
"settings": {
|
||||
"default": "web-page",
|
||||
"description": null,
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Type",
|
||||
"required": true,
|
||||
"type": "union",
|
||||
"variants": {
|
||||
"redirect": {
|
||||
"name": "Redirect",
|
||||
"spec": {
|
||||
"target": {
|
||||
"default": null,
|
||||
"description": "The subdomain of your Start9 Pages .onion address to redirect to. This should be the name of another subdomain on Start9 Pages. Leave empty to redirect to the homepage.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Target Subdomain",
|
||||
"patterns": [
|
||||
{
|
||||
"description": "May contain only lowercase characters and hyphens.",
|
||||
"regex": "^[a-z-]+$",
|
||||
},
|
||||
],
|
||||
"placeholder": null,
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
},
|
||||
},
|
||||
"web-page": {
|
||||
"name": "Web Page",
|
||||
"spec": {
|
||||
"folder": {
|
||||
"default": null,
|
||||
"description": "The path to the folder that contains the website files. For example, a value of "projects/resume" would tell Start9 Pages to look for that folder path in the selected service.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "Folder Path",
|
||||
"patterns": [
|
||||
{
|
||||
"description": "Must be a valid relative file path",
|
||||
"regex": "^(\\.|[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)(/[a-zA-Z0-9_ -][a-zA-Z0-9_ .-]*|/([a-zA-Z0-9_ .-][a-zA-Z0-9_ -]+\\.*)+)*/?$",
|
||||
},
|
||||
],
|
||||
"placeholder": "e.g. websites/resume",
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
"source": {
|
||||
"default": "nextcloud",
|
||||
"description": "The service that contains your website files.",
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Folder Location",
|
||||
"required": false,
|
||||
"type": "select",
|
||||
"values": {
|
||||
"filebrowser": undefined,
|
||||
"nextcloud": undefined,
|
||||
},
|
||||
"warning": null,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
"warning": null,
|
||||
},
|
||||
},
|
||||
"type": "object",
|
||||
"uniqueBy": "name",
|
||||
},
|
||||
"type": "list",
|
||||
"warning": null,
|
||||
},
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`transformConfigSpec transformConfigSpec(searNXG) 1`] = `
|
||||
{
|
||||
"enable-metrics": {
|
||||
"default": true,
|
||||
"description": "Your SearXNG instance will collect anonymous stats about its own usage and performance. You can view these metrics by appending \`/stats\` or \`/stats/errors\` to your SearXNG URL.",
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Enable Stats",
|
||||
"type": "toggle",
|
||||
"warning": null,
|
||||
},
|
||||
"instance-name": {
|
||||
"default": "My SearXNG Engine",
|
||||
"description": "Enter a name for your SearXNG instance. This is the name that will be listed if you want to share your SearXNG engine publicly.",
|
||||
"disabled": false,
|
||||
"generate": null,
|
||||
"immutable": false,
|
||||
"inputmode": "text",
|
||||
"masked": false,
|
||||
"maxLength": null,
|
||||
"minLength": null,
|
||||
"name": "SearXNG Instance Name",
|
||||
"patterns": [],
|
||||
"placeholder": "Uncle Jim SearXNG Engine",
|
||||
"required": true,
|
||||
"type": "text",
|
||||
"warning": null,
|
||||
},
|
||||
"tor-url": {
|
||||
"default": false,
|
||||
"description": "Activates the utilization of a .onion address as the primary URL, particularly beneficial for publicly hosted instances over the Tor network.",
|
||||
"disabled": false,
|
||||
"immutable": false,
|
||||
"name": "Enable Tor address as the base URL",
|
||||
"type": "toggle",
|
||||
"warning": null,
|
||||
},
|
||||
}
|
||||
`;
|
||||
@@ -0,0 +1,23 @@
|
||||
import { matchOldConfigSpec, transformConfigSpec } from "./transformConfigSpec"
|
||||
import fixtureEmbasyPagesConfig from "./__fixtures__/embasyPagesConfig"
|
||||
import searNXG from "./__fixtures__/searNXG"
|
||||
|
||||
describe("transformConfigSpec", () => {
|
||||
test("matchOldConfigSpec(embassyPages.homepage.variants[web-page])", () => {
|
||||
matchOldConfigSpec.unsafeCast(
|
||||
fixtureEmbasyPagesConfig.homepage.variants["web-page"],
|
||||
)
|
||||
})
|
||||
test("matchOldConfigSpec(embassyPages)", () => {
|
||||
matchOldConfigSpec.unsafeCast(fixtureEmbasyPagesConfig)
|
||||
})
|
||||
test("transformConfigSpec(embassyPages)", () => {
|
||||
const spec = matchOldConfigSpec.unsafeCast(fixtureEmbasyPagesConfig)
|
||||
expect(transformConfigSpec(spec)).toMatchSnapshot()
|
||||
})
|
||||
|
||||
test("transformConfigSpec(searNXG)", () => {
|
||||
const spec = matchOldConfigSpec.unsafeCast(searNXG)
|
||||
expect(transformConfigSpec(spec)).toMatchSnapshot()
|
||||
})
|
||||
})
|
||||
@@ -104,7 +104,7 @@ export function transformConfigSpec(oldSpec: OldConfigSpec): CT.InputSpec {
|
||||
: [],
|
||||
minLength: null,
|
||||
maxLength: null,
|
||||
masked: oldVal.masked,
|
||||
masked: oldVal.masked || false,
|
||||
generate: null,
|
||||
inputmode: "text",
|
||||
placeholder: oldVal.placeholder || null,
|
||||
@@ -347,11 +347,11 @@ type OldDefaultString = typeof matchOldDefaultString._TYPE
|
||||
|
||||
export const matchOldValueSpecString = object(
|
||||
{
|
||||
type: literals("string"),
|
||||
name: string,
|
||||
masked: boolean,
|
||||
copyable: boolean,
|
||||
type: literals("string"),
|
||||
nullable: boolean,
|
||||
name: string,
|
||||
placeholder: string,
|
||||
pattern: string,
|
||||
"pattern-description": string,
|
||||
@@ -361,6 +361,9 @@ export const matchOldValueSpecString = object(
|
||||
warning: string,
|
||||
},
|
||||
[
|
||||
"masked",
|
||||
"copyable",
|
||||
"nullable",
|
||||
"placeholder",
|
||||
"pattern",
|
||||
"pattern-description",
|
||||
|
||||
Reference in New Issue
Block a user