Adds encrypted token storage per release widget so users can authenticate with GitHub, GitLab, Docker Hub, etc. without needing full integration setup. - New `widget_secret` table (all 3 DB drivers) keyed by (itemId, kind) - tRPC router with setSecret/deleteSecret/getConfiguredKinds (board modify access required) - Releases router injects decrypted tokens into provider requests (board view access required) - Tokens only used for repos matching widget's stored configuration (prevents proxy abuse) - Provider auth: GitHub (Octokit auth), GitLab (PRIVATE-TOKEN), Docker Hub (Bearer), GHCR (registry token), npm (Bearer), Codeberg (token header) - UI: "Provider Tokens" section in widget editor with PasswordInput per provider
65 lines
1.8 KiB
TypeScript
65 lines
1.8 KiB
TypeScript
import type { InferSelectModel } from "drizzle-orm";
|
|
|
|
import { createSchema } from "@homarr/core/infrastructure/db";
|
|
|
|
import * as mysqlSchema from "./mysql";
|
|
import * as pgSchema from "./postgresql";
|
|
import * as sqliteSchema from "./sqlite";
|
|
|
|
export type PostgreSqlSchema = typeof pgSchema;
|
|
export type MySqlSchema = typeof mysqlSchema;
|
|
|
|
export const schema = createSchema({
|
|
"better-sqlite3": () => sqliteSchema,
|
|
mysql2: () => mysqlSchema,
|
|
"node-postgres": () => pgSchema,
|
|
});
|
|
|
|
// Sadly we can't use export * from here as we have multiple possible exports
|
|
export const {
|
|
accounts,
|
|
apiKeys,
|
|
apps,
|
|
boardGroupPermissions,
|
|
boardUserPermissions,
|
|
boards,
|
|
groupMembers,
|
|
groupPermissions,
|
|
groups,
|
|
iconRepositories,
|
|
icons,
|
|
integrationGroupPermissions,
|
|
integrationItems,
|
|
integrationSecrets,
|
|
integrationUserPermissions,
|
|
integrations,
|
|
invites,
|
|
items,
|
|
medias,
|
|
onboarding,
|
|
searchEngines,
|
|
sections,
|
|
serverSettings,
|
|
sessions,
|
|
users,
|
|
verificationTokens,
|
|
sectionCollapseStates,
|
|
layouts,
|
|
itemLayouts,
|
|
sectionLayouts,
|
|
trustedCertificateHostnames,
|
|
cronJobConfigurations,
|
|
customWidgetDefinitions,
|
|
customWidgetSecrets,
|
|
widgetSecrets,
|
|
} = schema;
|
|
|
|
export type User = InferSelectModel<typeof schema.users>;
|
|
export type Account = InferSelectModel<typeof schema.accounts>;
|
|
export type Session = InferSelectModel<typeof schema.sessions>;
|
|
export type VerificationToken = InferSelectModel<typeof schema.verificationTokens>;
|
|
export type Integration = InferSelectModel<typeof schema.integrations>;
|
|
export type IntegrationSecret = InferSelectModel<typeof schema.integrationSecrets>;
|
|
export type CustomWidgetDefinition = InferSelectModel<typeof schema.customWidgetDefinitions>;
|
|
export type CustomWidgetSecret = InferSelectModel<typeof schema.customWidgetSecrets>;
|