Skip to content

Commit

Permalink
feat: register dev center to apps
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Jul 8, 2024
1 parent e73d55b commit 10f4d7d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/backend/src/SelfHostedModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
},
],
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand All @@ -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 ) {
Expand Down Expand Up @@ -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}`);
Expand Down
27 changes: 27 additions & 0 deletions src/backend/src/services/database/sqlite_setup/0020_dev-center.sql
Original file line number Diff line number Diff line change
@@ -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_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2LjA4NiBMIDU4LjEyOSA1OS4wODYgWiIgc3R5bGU9ImZpbGw6IHJnYigzMiwgODksIDE1OCk7Ii8+CiAgPHBhdGggZD0iTSAyOS4xMjkgMTMuMDg2IEwgNTguMTI5IDI1LjA4NiBMIDg3LjEyOSAxMy4wODYgTCA1OC4xMjkgMS4wODYgTCAyOS4xMjkgMTMuMDg2IFoiIHN0eWxlPSJmaWxsOiByZ2IoNDcsIDEzNCwgMjM2KTsiLz4KICA8cGF0aCBkPSJNIDU5LjEyOSA2Mi4wODYgTCA4Ny4xMjkgNzQuMDg1IEwgODcuMTI5IDEwOC4wODUgTCA1OS4xMjkgOTYuMDg1IEwgNTkuMTI5IDYyLjA4NiBaIiBzdHlsZT0iZmlsbDogcmdiKDM0LCAxNzksIDApOyIvPgogIDxwYXRoIGQ9Ik0gODguMTI5IDEwOC4wODUgTCAxMTYuMTI5IDk2LjE1MSBMIDExNi4xMjkgNjIuMDg2IEwgODguMTI5IDc0LjA4NSBMIDg4LjEyOSAxMDguMDg1IFoiIHN0eWxlPSJmaWxsOiByZ2IoMjYsIDEzNiwgMCk7Ii8+CiAgPHBhdGggZD0iTSA1OS4xMjkgNjEuMDg2IEwgODcuNjI5IDczLjA4NSBMIDExNi4xMjkgNjEuMDg2IEwgODcuMTI5IDUwLjA4NiBMIDU5LjEyOSA2MS4wODYgWiIgc3R5bGU9ImZpbGw6IHJnYig0MCwgMjEzLCAwKTsiLz4KICA8ZGVmcy8+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
);

0 comments on commit 10f4d7d

Please sign in to comment.