2022-02-11 23:59:03 +08:00
|
|
|
import { skip } from '@nocobase/acl';
|
2022-02-11 18:13:14 +08:00
|
|
|
import { Plugin } from '@nocobase/server';
|
|
|
|
import { resolve } from 'path';
|
2021-08-13 23:14:07 +08:00
|
|
|
|
2022-02-11 18:13:14 +08:00
|
|
|
export class SystemSettingsPlugin extends Plugin {
|
2022-02-28 21:49:50 +08:00
|
|
|
async install() {
|
|
|
|
await this.db.getRepository('systemSettings').create({
|
|
|
|
values: {
|
|
|
|
title: 'NocoBase',
|
|
|
|
logo: {
|
|
|
|
title: 'nocobase-logo',
|
|
|
|
filename: '682e5ad037dd02a0fe4800a3e91c283b.png',
|
|
|
|
extname: '.png',
|
|
|
|
mimetype: 'image/png',
|
|
|
|
url: 'https://nocobase.oss-cn-beijing.aliyuncs.com/682e5ad037dd02a0fe4800a3e91c283b.png',
|
2021-09-23 00:16:04 +08:00
|
|
|
},
|
2022-02-28 21:49:50 +08:00
|
|
|
},
|
2021-09-11 18:53:26 +08:00
|
|
|
});
|
2022-02-07 01:14:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async load() {
|
|
|
|
await this.app.db.import({
|
2022-02-11 18:13:14 +08:00
|
|
|
directory: resolve(__dirname, 'collections'),
|
2022-02-07 01:14:00 +08:00
|
|
|
});
|
2022-02-11 23:59:03 +08:00
|
|
|
this.app.acl.use(
|
|
|
|
skip({
|
|
|
|
resourceName: 'systemSettings',
|
|
|
|
actionName: 'get',
|
|
|
|
}),
|
|
|
|
);
|
2022-02-07 01:14:00 +08:00
|
|
|
}
|
2022-03-28 22:01:10 +08:00
|
|
|
|
|
|
|
getName(): string {
|
|
|
|
return this.getPackageName(__dirname);
|
|
|
|
}
|
2022-02-07 01:14:00 +08:00
|
|
|
}
|
2022-02-11 18:13:14 +08:00
|
|
|
|
|
|
|
export default SystemSettingsPlugin;
|