mirror of
https://github.com/pocket-id/pocket-id.git
synced 2026-02-15 07:00:06 +00:00
chore: preparation for merge into main branch
This commit is contained in:
@@ -168,7 +168,7 @@ func ValidateEnvConfig(config *EnvConfigSchema) error {
|
|||||||
switch config.FileBackend {
|
switch config.FileBackend {
|
||||||
case "s3", "database":
|
case "s3", "database":
|
||||||
// All good, these are valid values
|
// All good, these are valid values
|
||||||
case "", "fs":
|
case "", "filesystem":
|
||||||
if config.UploadPath == "" {
|
if config.UploadPath == "" {
|
||||||
config.UploadPath = defaultFsUploadPath
|
config.UploadPath = defaultFsUploadPath
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ func TestParseEnvConfig(t *testing.T) {
|
|||||||
t.Setenv("APP_URL", "http://localhost:3000")
|
t.Setenv("APP_URL", "http://localhost:3000")
|
||||||
t.Setenv("AUDIT_LOG_RETENTION_DAYS", "0")
|
t.Setenv("AUDIT_LOG_RETENTION_DAYS", "0")
|
||||||
|
|
||||||
err := parseEnvConfig()
|
err := parseAndValidateEnvConfig(t)
|
||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
assert.ErrorContains(t, err, "AUDIT_LOG_RETENTION_DAYS must be greater than 0")
|
assert.ErrorContains(t, err, "AUDIT_LOG_RETENTION_DAYS must be greater than 0")
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ func (s *ExportService) extractDatabase() (DatabaseExport, error) {
|
|||||||
Tables: map[string][]map[string]any{},
|
Tables: map[string][]map[string]any{},
|
||||||
// These tables need to be inserted in a specific order because of foreign key constraints
|
// These tables need to be inserted in a specific order because of foreign key constraints
|
||||||
// Not all tables are listed here, because not all tables are order-dependent
|
// Not all tables are listed here, because not all tables are order-dependent
|
||||||
TableOrder: []string{"users", "user_groups", "oidc_clients"},
|
TableOrder: []string{"users", "user_groups", "oidc_clients", "signup_tokens"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for table := range schema {
|
for table := range schema {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ func (s *ImportService) ImportFromZip(ctx context.Context, r *zip.Reader) error
|
|||||||
|
|
||||||
// ImportDatabase only imports the database data from the given DatabaseExport struct.
|
// ImportDatabase only imports the database data from the given DatabaseExport struct.
|
||||||
func (s *ImportService) ImportDatabase(dbData DatabaseExport) error {
|
func (s *ImportService) ImportDatabase(dbData DatabaseExport) error {
|
||||||
err := s.resetSchema(dbData.Version, dbData.Provider)
|
err := s.resetSchema(dbData.Version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -144,7 +144,7 @@ func (s *ImportService) importUploads(ctx context.Context, files []*zip.File) er
|
|||||||
}
|
}
|
||||||
|
|
||||||
// resetSchema drops the existing schema and migrates to the target version
|
// resetSchema drops the existing schema and migrates to the target version
|
||||||
func (s *ImportService) resetSchema(targetVersion uint, exportDbProvider string) error {
|
func (s *ImportService) resetSchema(targetVersion uint) error {
|
||||||
sqlDb, err := s.db.DB()
|
sqlDb, err := s.db.DB()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get sql.DB: %w", err)
|
return fmt.Errorf("failed to get sql.DB: %w", err)
|
||||||
@@ -155,11 +155,19 @@ func (s *ImportService) resetSchema(targetVersion uint, exportDbProvider string)
|
|||||||
return fmt.Errorf("failed to get migrate instance: %w", err)
|
return fmt.Errorf("failed to get migrate instance: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.db.Name() == "sqlite" {
|
||||||
|
s.db.Exec("PRAGMA foreign_keys = OFF;")
|
||||||
|
}
|
||||||
|
|
||||||
err = m.Drop()
|
err = m.Drop()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to drop existing schema: %w", err)
|
return fmt.Errorf("failed to drop existing schema: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if s.db.Name() == "sqlite" {
|
||||||
|
defer s.db.Exec("PRAGMA foreign_keys = ON;")
|
||||||
|
}
|
||||||
|
|
||||||
// Needs to be called again to re-create the schema_migrations table
|
// Needs to be called again to re-create the schema_migrations table
|
||||||
m, err = utils.GetEmbeddedMigrateInstance(sqlDb)
|
m, err = utils.GetEmbeddedMigrateInstance(sqlDb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
-- No-op in Postgres
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
-- No-op in Postgres
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- This migration is part of v2
|
||||||
|
|
||||||
|
-- No-op in Postgres
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- This migration is part of v2
|
||||||
|
|
||||||
|
-- No-op in Postgres
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
-- This migration is part of v2
|
||||||
|
|
||||||
PRAGMA foreign_keys = OFF;
|
PRAGMA foreign_keys = OFF;
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
-- This migration is part of v2
|
||||||
|
|
||||||
PRAGMA foreign_keys = OFF;
|
PRAGMA foreign_keys = OFF;
|
||||||
|
|
||||||
BEGIN;
|
BEGIN;
|
||||||
@@ -36,9 +36,7 @@
|
|||||||
<Card.Root>
|
<Card.Root>
|
||||||
<Card.Header>
|
<Card.Header>
|
||||||
<Card.Title>{m.global_audit_log()}</Card.Title>
|
<Card.Title>{m.global_audit_log()}</Card.Title>
|
||||||
<Card.Description class="mt-1"
|
<Card.Description class="mt-1">{m.see_all_recent_account_activities()}</Card.Description>
|
||||||
>{m.see_all_recent_account_activities()}</Card.Description
|
|
||||||
>
|
|
||||||
</Card.Header>
|
</Card.Header>
|
||||||
<Card.Content>
|
<Card.Content>
|
||||||
<div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-4">
|
<div class="mb-6 grid grid-cols-1 gap-4 md:grid-cols-4">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"provider": "sqlite",
|
"provider": "sqlite",
|
||||||
"version": 20251117141000,
|
"version": 20251219000000,
|
||||||
"tableOrder": ["users", "user_groups", "oidc_clients"],
|
"tableOrder": ["users", "user_groups", "oidc_clients", "signup_tokens"],
|
||||||
"tables": {
|
"tables": {
|
||||||
"api_keys": [
|
"api_keys": [
|
||||||
{
|
{
|
||||||
@@ -63,6 +63,7 @@
|
|||||||
"dark_image_type": null,
|
"dark_image_type": null,
|
||||||
"id": "3654a746-35d4-4321-ac61-0bdcff2b4055",
|
"id": "3654a746-35d4-4321-ac61-0bdcff2b4055",
|
||||||
"image_type": "png",
|
"image_type": "png",
|
||||||
|
"is_group_restricted": false,
|
||||||
"is_public": false,
|
"is_public": false,
|
||||||
"launch_url": "https://nextcloud.local",
|
"launch_url": "https://nextcloud.local",
|
||||||
"logout_callback_urls": "WyJodHRwOi8vbmV4dGNsb3VkL2F1dGgvbG9nb3V0L2NhbGxiYWNrIl0=",
|
"logout_callback_urls": "WyJodHRwOi8vbmV4dGNsb3VkL2F1dGgvbG9nb3V0L2NhbGxiYWNrIl0=",
|
||||||
@@ -79,6 +80,7 @@
|
|||||||
"dark_image_type": null,
|
"dark_image_type": null,
|
||||||
"id": "606c7782-f2b1-49e5-8ea9-26eb1b06d018",
|
"id": "606c7782-f2b1-49e5-8ea9-26eb1b06d018",
|
||||||
"image_type": null,
|
"image_type": null,
|
||||||
|
"is_group_restricted": true,
|
||||||
"is_public": false,
|
"is_public": false,
|
||||||
"launch_url": null,
|
"launch_url": null,
|
||||||
"logout_callback_urls": "bnVsbA==",
|
"logout_callback_urls": "bnVsbA==",
|
||||||
@@ -95,6 +97,7 @@
|
|||||||
"dark_image_type": null,
|
"dark_image_type": null,
|
||||||
"id": "7c21a609-96b5-4011-9900-272b8d31a9d1",
|
"id": "7c21a609-96b5-4011-9900-272b8d31a9d1",
|
||||||
"image_type": null,
|
"image_type": null,
|
||||||
|
"is_group_restricted": true,
|
||||||
"is_public": false,
|
"is_public": false,
|
||||||
"launch_url": null,
|
"launch_url": null,
|
||||||
"logout_callback_urls": "WyJodHRwOi8vdGFpbHNjYWxlL2F1dGgvbG9nb3V0L2NhbGxiYWNrIl0=",
|
"logout_callback_urls": "WyJodHRwOi8vdGFpbHNjYWxlL2F1dGgvbG9nb3V0L2NhbGxiYWNrIl0=",
|
||||||
@@ -111,6 +114,7 @@
|
|||||||
"dark_image_type": null,
|
"dark_image_type": null,
|
||||||
"id": "c48232ff-ff65-45ed-ae96-7afa8a9b443b",
|
"id": "c48232ff-ff65-45ed-ae96-7afa8a9b443b",
|
||||||
"image_type": null,
|
"image_type": null,
|
||||||
|
"is_group_restricted": false,
|
||||||
"is_public": false,
|
"is_public": false,
|
||||||
"launch_url": null,
|
"launch_url": null,
|
||||||
"logout_callback_urls": "bnVsbA==",
|
"logout_callback_urls": "bnVsbA==",
|
||||||
@@ -143,6 +147,7 @@
|
|||||||
"expires_at": "2025-11-25T13:39:02Z",
|
"expires_at": "2025-11-25T13:39:02Z",
|
||||||
"id": "bf877753-4ea4-4c9c-bbbd-e198bb201cb8",
|
"id": "bf877753-4ea4-4c9c-bbbd-e198bb201cb8",
|
||||||
"token": "HPe6k6uiDRRVuAQV",
|
"token": "HPe6k6uiDRRVuAQV",
|
||||||
|
"device_token": null,
|
||||||
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -150,6 +155,7 @@
|
|||||||
"expires_at": "2025-11-25T12:39:01Z",
|
"expires_at": "2025-11-25T12:39:01Z",
|
||||||
"id": "d3afae24-fe2d-4a98-abec-cf0b8525096a",
|
"id": "d3afae24-fe2d-4a98-abec-cf0b8525096a",
|
||||||
"token": "YCGDtftvsvYWiXd0",
|
"token": "YCGDtftvsvYWiXd0",
|
||||||
|
"device_token": null,
|
||||||
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -157,6 +163,7 @@
|
|||||||
"expires_at": "2025-11-25T13:39:02Z",
|
"expires_at": "2025-11-25T13:39:02Z",
|
||||||
"id": "defd5164-9d9b-4228-bbce-708e33f49360",
|
"id": "defd5164-9d9b-4228-bbce-708e33f49360",
|
||||||
"token": "one-time-token",
|
"token": "one-time-token",
|
||||||
|
"device_token": null,
|
||||||
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
"user_id": "f4b89dc2-62fb-46bf-9f5f-c34f4eafe93e"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -194,6 +201,12 @@
|
|||||||
"usage_limit": 1
|
"usage_limit": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"signup_tokens_user_groups": [
|
||||||
|
{
|
||||||
|
"signup_token_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
|
||||||
|
"user_group_id": "c7ae7c01-28a3-4f3c-9572-1ee734ea8368"
|
||||||
|
}
|
||||||
|
],
|
||||||
"user_authorized_oidc_clients": [
|
"user_authorized_oidc_clients": [
|
||||||
{
|
{
|
||||||
"client_id": "3654a746-35d4-4321-ac61-0bdcff2b4055",
|
"client_id": "3654a746-35d4-4321-ac61-0bdcff2b4055",
|
||||||
|
|||||||
@@ -126,7 +126,9 @@ test.describe('Update application images', () => {
|
|||||||
await page.getByLabel('Light Mode Logo').setInputFiles('resources/images/pingvin-share-logo.png');
|
await page.getByLabel('Light Mode Logo').setInputFiles('resources/images/pingvin-share-logo.png');
|
||||||
await page.getByLabel('Dark Mode Logo').setInputFiles('resources/images/cloud-logo.png');
|
await page.getByLabel('Dark Mode Logo').setInputFiles('resources/images/cloud-logo.png');
|
||||||
await page.getByLabel('Email Logo').setInputFiles('resources/images/pingvin-share-logo.png');
|
await page.getByLabel('Email Logo').setInputFiles('resources/images/pingvin-share-logo.png');
|
||||||
await page.getByLabel('Default Profile Picture').setInputFiles('resources/images/pingvin-share-logo.png');
|
await page
|
||||||
|
.getByLabel('Default Profile Picture')
|
||||||
|
.setInputFiles('resources/images/pingvin-share-logo.png');
|
||||||
await page.getByLabel('Background Image').setInputFiles('resources/images/clouds.jpg');
|
await page.getByLabel('Background Image').setInputFiles('resources/images/clouds.jpg');
|
||||||
await page.getByRole('button', { name: 'Save' }).last().click();
|
await page.getByRole('button', { name: 'Save' }).last().click();
|
||||||
|
|
||||||
|
|||||||
@@ -287,7 +287,6 @@ function runExportToStdout(): Buffer {
|
|||||||
'--path',
|
'--path',
|
||||||
'-'
|
'-'
|
||||||
]);
|
]);
|
||||||
fs.writeFileSync('export-stdout.txt', res);
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user