mirror of
https://github.com/swissmakers/swiss-datashare.git
synced 2026-04-11 10:27:01 +02:00
feat: improve config UI (#69)
* add first concept * completed configuration ui update * add button for testing email configuration * improve mobile layout * add migration * run formatter * delete unnecessary modal * remove unused comment
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- Added the required column `category` to the `Config` table without a default value. This is not possible if the table is not empty.
|
||||
|
||||
*/
|
||||
-- RedefineTables
|
||||
PRAGMA foreign_keys=OFF;
|
||||
CREATE TABLE "new_Config" (
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"key" TEXT NOT NULL PRIMARY KEY,
|
||||
"type" TEXT NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
"description" TEXT NOT NULL,
|
||||
"category" TEXT,
|
||||
"obscured" BOOLEAN NOT NULL DEFAULT false,
|
||||
"secret" BOOLEAN NOT NULL DEFAULT true,
|
||||
"locked" BOOLEAN NOT NULL DEFAULT false
|
||||
);
|
||||
INSERT INTO "new_Config" ("description", "key", "locked", "obscured", "secret", "type", "updatedAt", "value") SELECT "description", "key", "locked", "obscured", "secret", "type", "updatedAt", "value" FROM "Config";
|
||||
DROP TABLE "Config";
|
||||
ALTER TABLE "new_Config" RENAME TO "Config";
|
||||
|
||||
UPDATE config SET category = "internal" WHERE key = "SETUP_FINISHED";
|
||||
UPDATE config SET category = "internal" WHERE key = "TOTP_SECRET";
|
||||
UPDATE config SET category = "internal" WHERE key = "JWT_SECRET";
|
||||
UPDATE config SET category = "general" WHERE key = "APP_URL";
|
||||
UPDATE config SET category = "general" WHERE key = "SHOW_HOME_PAGE";
|
||||
UPDATE config SET category = "share" WHERE key = "ALLOW_REGISTRATION";
|
||||
UPDATE config SET category = "share" WHERE key = "ALLOW_UNAUTHENTICATED_SHARES";
|
||||
UPDATE config SET category = "share" WHERE key = "MAX_FILE_SIZE";
|
||||
UPDATE config SET category = "email" WHERE key = "ENABLE_EMAIL_RECIPIENTS";
|
||||
UPDATE config SET category = "email" WHERE key = "EMAIL_MESSAGE";
|
||||
UPDATE config SET category = "email" WHERE key = "EMAIL_SUBJECT";
|
||||
UPDATE config SET category = "email" WHERE key = "SMTP_HOST";
|
||||
UPDATE config SET category = "email" WHERE key = "SMTP_PORT";
|
||||
UPDATE config SET category = "email" WHERE key = "SMTP_EMAIL";
|
||||
UPDATE config SET category = "email" WHERE key = "SMTP_USERNAME";
|
||||
UPDATE config SET category = "email" WHERE key = "SMTP_PASSWORD";
|
||||
|
||||
CREATE TABLE "new_Config" (
|
||||
"updatedAt" DATETIME NOT NULL,
|
||||
"key" TEXT NOT NULL PRIMARY KEY,
|
||||
"type" TEXT NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
"description" TEXT NOT NULL,
|
||||
"category" TEXT NOT NULL,
|
||||
"obscured" BOOLEAN NOT NULL DEFAULT false,
|
||||
"secret" BOOLEAN NOT NULL DEFAULT true,
|
||||
"locked" BOOLEAN NOT NULL DEFAULT false
|
||||
);
|
||||
INSERT INTO "new_Config" ("description", "key", "locked", "obscured", "secret", "type", "updatedAt", "value", "category") SELECT "description", "key", "locked", "obscured", "secret", "type", "updatedAt", "value", "category" FROM "Config";
|
||||
DROP TABLE "Config";
|
||||
ALTER TABLE "new_Config" RENAME TO "Config";
|
||||
PRAGMA foreign_key_check;
|
||||
PRAGMA foreign_keys=ON;
|
||||
@@ -101,6 +101,7 @@ model Config {
|
||||
type String
|
||||
value String
|
||||
description String
|
||||
category String
|
||||
obscured Boolean @default(false)
|
||||
secret Boolean @default(true)
|
||||
locked Boolean @default(false)
|
||||
|
||||
@@ -7,6 +7,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Whether the setup has been finished",
|
||||
type: "boolean",
|
||||
value: "false",
|
||||
category: "internal",
|
||||
secret: false,
|
||||
locked: true,
|
||||
},
|
||||
@@ -15,6 +16,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "On which URL Pingvin Share is available",
|
||||
type: "string",
|
||||
value: "http://localhost:3000",
|
||||
category: "general",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -22,6 +24,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Whether to show the home page",
|
||||
type: "boolean",
|
||||
value: "true",
|
||||
category: "general",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -29,6 +32,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Whether registration is allowed",
|
||||
type: "boolean",
|
||||
value: "true",
|
||||
category: "share",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -36,6 +40,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Whether unauthorized users can create shares",
|
||||
type: "boolean",
|
||||
value: "false",
|
||||
category: "share",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -43,6 +48,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Maximum file size in bytes",
|
||||
type: "number",
|
||||
value: "1000000000",
|
||||
category: "share",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -50,6 +56,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "Long random string used to sign JWT tokens",
|
||||
type: "string",
|
||||
value: crypto.randomBytes(256).toString("base64"),
|
||||
category: "internal",
|
||||
locked: true,
|
||||
},
|
||||
{
|
||||
@@ -57,6 +64,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
description: "A 16 byte random string used to generate TOTP secrets",
|
||||
type: "string",
|
||||
value: crypto.randomBytes(16).toString("base64"),
|
||||
category: "internal",
|
||||
locked: true,
|
||||
},
|
||||
{
|
||||
@@ -65,6 +73,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
"Whether to send emails to recipients. Only set this to true if you entered the host, port, email, user and password of your SMTP server.",
|
||||
type: "boolean",
|
||||
value: "false",
|
||||
category: "email",
|
||||
secret: false,
|
||||
},
|
||||
{
|
||||
@@ -74,36 +83,42 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
type: "text",
|
||||
value:
|
||||
"Hey!\n{creator} shared some files with you. View or download the files with this link: {shareUrl}\nShared securely with Pingvin Share 🐧",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "EMAIL_SUBJECT",
|
||||
description: "Subject of the email which gets sent to the recipients.",
|
||||
type: "string",
|
||||
value: "Files shared with you",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "SMTP_HOST",
|
||||
description: "Host of the SMTP server",
|
||||
type: "string",
|
||||
value: "",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "SMTP_PORT",
|
||||
description: "Port of the SMTP server",
|
||||
type: "number",
|
||||
value: "",
|
||||
value: "0",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "SMTP_EMAIL",
|
||||
description: "Email address which the emails get sent from",
|
||||
type: "string",
|
||||
value: "",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "SMTP_USERNAME",
|
||||
description: "Username of the SMTP server",
|
||||
type: "string",
|
||||
value: "",
|
||||
category: "email",
|
||||
},
|
||||
{
|
||||
key: "SMTP_PASSWORD",
|
||||
@@ -111,6 +126,7 @@ const configVariables: Prisma.ConfigCreateInput[] = [
|
||||
type: "string",
|
||||
value: "",
|
||||
obscured: true,
|
||||
category: "email",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user