1.0.34
This commit is contained in:
56 files changed
+9101
-117
No files matched your search
@@ -769,7 +769,8 @@ async function seedDatabase(): Promise<void> {
|
||||
license: ['manage'],
|
||||
audit_logs: ['view'],
|
||||
activity: ['view'],
|
||||
schedules: ['view', 'edit', 'run']
|
||||
schedules: ['view', 'edit', 'run'],
|
||||
templates: ['view', 'deploy', 'manage']
|
||||
});
|
||||
|
||||
const operatorPermissions = JSON.stringify({
|
||||
@@ -788,7 +789,8 @@ async function seedDatabase(): Promise<void> {
|
||||
license: [],
|
||||
audit_logs: [],
|
||||
activity: ['view'],
|
||||
schedules: ['view', 'edit', 'run']
|
||||
schedules: ['view', 'edit', 'run'],
|
||||
templates: ['view', 'deploy']
|
||||
});
|
||||
|
||||
const viewerPermissions = JSON.stringify({
|
||||
@@ -807,9 +809,31 @@ async function seedDatabase(): Promise<void> {
|
||||
license: [],
|
||||
audit_logs: [],
|
||||
activity: ['view'],
|
||||
schedules: ['view']
|
||||
schedules: ['view'],
|
||||
templates: ['view']
|
||||
});
|
||||
|
||||
// Seed template sources if table is empty
|
||||
const existingTemplateSources = await db.select().from(schema.templateSources);
|
||||
if (existingTemplateSources.length === 0) {
|
||||
// Inline defaults to avoid circular dependency (library.ts imports db/drizzle)
|
||||
const defaultSources = [
|
||||
{ sourceId: 'portainer-lissy93', name: 'Portainer templates (Lissy93)', url: 'https://raw.githubusercontent.com/Lissy93/portainer-templates/main/templates.json', enabled: true, builtin: true, sortOrder: 0 },
|
||||
{ sourceId: 'ntv-one', name: 'NTV-One (consolidated)', url: 'https://raw.githubusercontent.com/ntv-one/portainer/main/template.json', enabled: false, builtin: true, sortOrder: 1 },
|
||||
{ sourceId: 'mlva', name: 'MLVA (TheLustriVA)', url: 'https://raw.githubusercontent.com/TheLustriVA/portainer-templates-Nov-2022-collection/main/templates_2_2_rc_2_2.json', enabled: false, builtin: true, sortOrder: 2 },
|
||||
{ sourceId: 'selfhostedpro', name: 'SelfHostedPro', url: 'https://raw.githubusercontent.com/SelfhostedPro/selfhosted_templates/master/Template/portainer-v2.json', enabled: false, builtin: true, sortOrder: 3 },
|
||||
{ sourceId: 'portainer-qballjos', name: 'Qballjos (homelab)', url: 'https://raw.githubusercontent.com/Qballjos/portainer_templates/master/Template/template.json', enabled: false, builtin: true, sortOrder: 4 },
|
||||
{ sourceId: 'lsio-technorabilia', name: 'LinuxServer.io (Technorabilia)', url: 'https://raw.githubusercontent.com/technorabilia/portainer-templates/main/lsio/templates/templates.json', enabled: true, builtin: true, sortOrder: 5 },
|
||||
{ sourceId: 'mikestraney', name: 'MikeStraney', url: 'https://raw.githubusercontent.com/mikestraney/portainer-templates/master/templates.json', enabled: false, builtin: true, sortOrder: 6 },
|
||||
{ sourceId: 'pi-hosted-amd64', name: 'Pi-Hosted (amd64)', url: 'https://raw.githubusercontent.com/pi-hosted/pi-hosted/master/template/portainer-v2-amd64.json', enabled: false, builtin: true, sortOrder: 7 },
|
||||
{ sourceId: 'pi-hosted-arm64', name: 'Pi-Hosted (arm64)', url: 'https://raw.githubusercontent.com/pi-hosted/pi-hosted/master/template/portainer-v2-arm64.json', enabled: false, builtin: true, sortOrder: 8 },
|
||||
];
|
||||
for (const source of defaultSources) {
|
||||
await db.insert(schema.templateSources).values(source);
|
||||
}
|
||||
logStep('Created default template sources');
|
||||
}
|
||||
|
||||
const existingRoles = await db.select().from(schema.roles);
|
||||
if (existingRoles.length === 0) {
|
||||
await db.insert(schema.roles).values([
|
||||
|
||||
@@ -505,6 +505,19 @@ export const userPreferences = sqliteTable('user_preferences', {
|
||||
unique().on(table.userId, table.environmentId, table.key)
|
||||
]);
|
||||
|
||||
// Template sources
|
||||
export const templateSources = sqliteTable('template_sources', {
|
||||
id: integer('id').primaryKey({ autoIncrement: true }),
|
||||
sourceId: text('source_id').notNull().unique(), // stable identifier (e.g., 'portainer-lissy93')
|
||||
name: text('name').notNull(),
|
||||
url: text('url').notNull(),
|
||||
enabled: integer('enabled', { mode: 'boolean' }).default(true),
|
||||
builtin: integer('builtin', { mode: 'boolean' }).default(false),
|
||||
sortOrder: integer('sort_order').default(0),
|
||||
createdAt: text('created_at').default(sql`CURRENT_TIMESTAMP`),
|
||||
updatedAt: text('updated_at').default(sql`CURRENT_TIMESTAMP`)
|
||||
});
|
||||
|
||||
// =============================================================================
|
||||
// TYPE EXPORTS
|
||||
// =============================================================================
|
||||
|
||||
@@ -507,3 +507,16 @@ export const userPreferences = pgTable('user_preferences', {
|
||||
}, (table) => [
|
||||
unique().on(table.userId, table.environmentId, table.key)
|
||||
]);
|
||||
|
||||
// Template sources
|
||||
export const templateSources = pgTable('template_sources', {
|
||||
id: serial('id').primaryKey(),
|
||||
sourceId: text('source_id').notNull().unique(), // stable identifier (e.g., 'portainer-lissy93')
|
||||
name: text('name').notNull(),
|
||||
url: text('url').notNull(),
|
||||
enabled: boolean('enabled').default(true),
|
||||
builtin: boolean('builtin').default(false),
|
||||
sortOrder: integer('sort_order').default(0),
|
||||
createdAt: timestamp('created_at', { mode: 'string' }).defaultNow(),
|
||||
updatedAt: timestamp('updated_at', { mode: 'string' }).defaultNow()
|
||||
});
|
||||
Reference in new issue
Block a user