mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
refactor: unify backend and frontend servers (#3)
* refactor: unify backend and frontend servers * refactor: correct paths for openapi & drizzle * refactor: move api-client to client * fix: drizzle paths * chore: fix linting issues * fix: form reset issue
This commit is contained in:
1
app/schemas/node_modules/arktype
generated
vendored
Symbolic link
1
app/schemas/node_modules/arktype
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../node_modules/.bun/arktype@2.1.26/node_modules/arktype
|
||||
71
app/schemas/restic.ts
Normal file
71
app/schemas/restic.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import { type } from "arktype";
|
||||
|
||||
export const REPOSITORY_BACKENDS = {
|
||||
local: "local",
|
||||
s3: "s3",
|
||||
gcs: "gcs",
|
||||
azure: "azure",
|
||||
rclone: "rclone",
|
||||
} as const;
|
||||
|
||||
export type RepositoryBackend = keyof typeof REPOSITORY_BACKENDS;
|
||||
|
||||
export const s3RepositoryConfigSchema = type({
|
||||
backend: "'s3'",
|
||||
endpoint: "string",
|
||||
bucket: "string",
|
||||
accessKeyId: "string",
|
||||
secretAccessKey: "string",
|
||||
});
|
||||
|
||||
export const localRepositoryConfigSchema = type({
|
||||
backend: "'local'",
|
||||
name: "string",
|
||||
});
|
||||
|
||||
export const gcsRepositoryConfigSchema = type({
|
||||
backend: "'gcs'",
|
||||
bucket: "string",
|
||||
projectId: "string",
|
||||
credentialsJson: "string",
|
||||
});
|
||||
|
||||
export const azureRepositoryConfigSchema = type({
|
||||
backend: "'azure'",
|
||||
container: "string",
|
||||
accountName: "string",
|
||||
accountKey: "string",
|
||||
endpointSuffix: "string?",
|
||||
});
|
||||
|
||||
export const rcloneRepositoryConfigSchema = type({
|
||||
backend: "'rclone'",
|
||||
remote: "string",
|
||||
path: "string",
|
||||
});
|
||||
|
||||
export const repositoryConfigSchema = s3RepositoryConfigSchema
|
||||
.or(localRepositoryConfigSchema)
|
||||
.or(gcsRepositoryConfigSchema)
|
||||
.or(azureRepositoryConfigSchema)
|
||||
.or(rcloneRepositoryConfigSchema);
|
||||
|
||||
export type RepositoryConfig = typeof repositoryConfigSchema.infer;
|
||||
|
||||
export const COMPRESSION_MODES = {
|
||||
off: "off",
|
||||
auto: "auto",
|
||||
fastest: "fastest",
|
||||
better: "better",
|
||||
max: "max",
|
||||
} as const;
|
||||
|
||||
export type CompressionMode = keyof typeof COMPRESSION_MODES;
|
||||
|
||||
export const REPOSITORY_STATUS = {
|
||||
healthy: "healthy",
|
||||
error: "error",
|
||||
unknown: "unknown",
|
||||
} as const;
|
||||
|
||||
export type RepositoryStatus = keyof typeof REPOSITORY_STATUS;
|
||||
60
app/schemas/volumes.ts
Normal file
60
app/schemas/volumes.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { type } from "arktype";
|
||||
|
||||
export const BACKEND_TYPES = {
|
||||
nfs: "nfs",
|
||||
smb: "smb",
|
||||
directory: "directory",
|
||||
webdav: "webdav",
|
||||
} as const;
|
||||
|
||||
export type BackendType = keyof typeof BACKEND_TYPES;
|
||||
|
||||
export const nfsConfigSchema = type({
|
||||
backend: "'nfs'",
|
||||
server: "string",
|
||||
exportPath: "string",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65536").default(2049),
|
||||
version: "'3' | '4' | '4.1'",
|
||||
readOnly: "boolean?",
|
||||
});
|
||||
|
||||
export const smbConfigSchema = type({
|
||||
backend: "'smb'",
|
||||
server: "string",
|
||||
share: "string",
|
||||
username: "string",
|
||||
password: "string",
|
||||
vers: type("'1.0' | '2.0' | '2.1' | '3.0'").default("3.0"),
|
||||
domain: "string?",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65535").default(445),
|
||||
readOnly: "boolean?",
|
||||
});
|
||||
|
||||
export const directoryConfigSchema = type({
|
||||
backend: "'directory'",
|
||||
path: "string",
|
||||
readOnly: "false?",
|
||||
});
|
||||
|
||||
export const webdavConfigSchema = type({
|
||||
backend: "'webdav'",
|
||||
server: "string",
|
||||
path: "string",
|
||||
username: "string?",
|
||||
password: "string?",
|
||||
port: type("string.integer").or(type("number")).to("1 <= number <= 65536").default(80),
|
||||
readOnly: "boolean?",
|
||||
ssl: "boolean?",
|
||||
});
|
||||
|
||||
export const volumeConfigSchema = nfsConfigSchema.or(smbConfigSchema).or(webdavConfigSchema).or(directoryConfigSchema);
|
||||
|
||||
export type BackendConfig = typeof volumeConfigSchema.infer;
|
||||
|
||||
export const BACKEND_STATUS = {
|
||||
mounted: "mounted",
|
||||
unmounted: "unmounted",
|
||||
error: "error",
|
||||
} as const;
|
||||
|
||||
export type BackendStatus = keyof typeof BACKEND_STATUS;
|
||||
Reference in New Issue
Block a user