From 10f4d7d50ce9314f9c3888c74cb17c8ebbecee98 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 7 Jul 2024 22:26:32 -0400 Subject: [PATCH] feat: register dev center to apps --- src/backend/src/SelfHostedModule.js | 4 +++ .../database/SqliteDatabaseAccessService.js | 7 ++++- .../database/sqlite_setup/0020_dev-center.sql | 27 +++++++++++++++++++ 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 src/backend/src/services/database/sqlite_setup/0020_dev-center.sql diff --git a/src/backend/src/SelfHostedModule.js b/src/backend/src/SelfHostedModule.js index 339298c30f..9a9625a1b7 100644 --- a/src/backend/src/SelfHostedModule.js +++ b/src/backend/src/SelfHostedModule.js @@ -74,6 +74,10 @@ class SelfHostedModule extends AdvancedBase { prefix: '/builtin/git', path: path_.resolve(__dirname, '../../../src/git/dist'), }, + { + prefix: '/builtin/dev-center', + path: path_.resolve(__dirname, '../../../src/dev-center'), + }, ], }); diff --git a/src/backend/src/services/database/SqliteDatabaseAccessService.js b/src/backend/src/services/database/SqliteDatabaseAccessService.js index d82357b26c..d157354106 100644 --- a/src/backend/src/services/database/SqliteDatabaseAccessService.js +++ b/src/backend/src/services/database/SqliteDatabaseAccessService.js @@ -42,7 +42,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { this.db = new Database(this.config.path); // Database upgrade logic - const TARGET_VERSION = 17; + const TARGET_VERSION = 18; if ( do_setup ) { this.log.noticeme(`SETUP: creating database at ${this.config.path}`); @@ -66,6 +66,7 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { '0017_publicdirs.sql', '0018_fix-0003.sql', '0019_fix-0016.sql', + '0020_dev-center.sql', ].map(p => path_.join(__dirname, 'sqlite_setup', p)); const fs = require('fs'); for ( const filename of sql_files ) { @@ -150,6 +151,10 @@ class SqliteDatabaseAccessService extends BaseDatabaseAccessService { upgrade_files.push('0019_fix-0016.sql'); } + if ( user_version <= 17 ) { + upgrade_files.push('0020_dev-center.sql'); + } + if ( upgrade_files.length > 0 ) { this.log.noticeme(`Database out of date: ${this.config.path}`); this.log.noticeme(`UPGRADING DATABASE: ${user_version} -> ${TARGET_VERSION}`); diff --git a/src/backend/src/services/database/sqlite_setup/0020_dev-center.sql b/src/backend/src/services/database/sqlite_setup/0020_dev-center.sql new file mode 100644 index 0000000000..b82c0606a3 --- /dev/null +++ b/src/backend/src/services/database/sqlite_setup/0020_dev-center.sql @@ -0,0 +1,27 @@ +INSERT INTO `apps` ( + `uid`, + `owner_user_id`, + `icon`, + `name`, + `title`, + `description`, + `index_url`, + `approved_for_listing`, + `approved_for_opening_items`, + `approved_for_incentive_program`, + `timestamp`, + `last_review`, + `godmode` +) VALUES ( + 'app-0b37f054-07d4-4627-8765-11bd23e889d4', + 1, + 'data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iMTE2IiBoZWlnaHQ9IjEzNiIgdmlld0JveD0iMCAwIDExNiAxMTYiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiAgPHBhdGggZD0iTSAwLjEyOSA2Mi4wODYgTCAyOC4xMjkgNzQuMDg1IEwgMjguMTI5IDEwOC4wODUgTCAwLjEyOSA5Ni42NDQgTCAwLjEyOSA2Mi4wODYgWiIgc3R5bGU9ImZpbGw6IHJnYigxNjQsIDczLCA3MSk7Ii8+CiAgPHBhdGggZD0iTSAyOS4xMjkgMTA4LjA4NSBMIDU3LjEyOSA5Ni4wODUgTCA1Ny4xMjkgNjIuMDg2IEwgMjkuMTI5IDc0LjA4NSBMIDI5LjEyOSAxMDguMDg1IFoiIHN0eWxlPSJmaWxsOiByZ2IoMTM1LCA1OCwgNTgpOyIvPgogIDxwYXRoIGQ9Ik0gMC4xMjkgNjEuMTc5IEwgMjguNjI5IDczLjA4NSBMIDU3LjI3NiA2MS4xNzkgTCAyOS4xMjkgNTAuMDg2IEwgM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Igc3R5bGU9ImZpbGw6IHJnYig0MCwgMjEzLCAwKTsiLz4KICA8ZGVmcy8+Cjwvc3ZnPg==', + 'dev-center', + 'Dev Center', + 'This is the app that makes apps', + 'https://builtins.namespaces.puter.com/dev-center', + 1, 1, 0, + '2020-01-01 00:00:00', + NULL, + 0 +);