forked from getgridea/gridea
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetting.ts
More file actions
42 lines (35 loc) · 1.08 KB
/
Copy pathsetting.ts
File metadata and controls
42 lines (35 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import * as fse from 'fs-extra'
import * as path from 'path'
import Model from './model'
import { ICommentSetting } from './interfaces/setting'
import { ISetting } from '../interfaces/setting'
export default class Setting extends Model {
getSetting() {
const setting = this.$setting.get('config').value()
return setting
}
getGitalkSetting() {
const setting = this.$setting.get('gitalk').value()
return setting
}
getCommentSetting() {
const setting = this.$setting.get('comment').value()
return setting
}
public async saveSetting(setting: ISetting) {
await this.$setting.set('config', setting).write()
return true
}
public async saveCommentSetting(setting: ICommentSetting) {
await this.$setting.set('comment', setting).write()
return true
}
async uploadFavicon(filePath: string) {
const faviconPath = path.join(this.appDir, 'favicon.ico')
fse.copySync(filePath, faviconPath)
}
async uploadAvatar(filePath: string) {
const avatarPath = path.join(this.appDir, 'images/avatar.png')
fse.copySync(filePath, avatarPath)
}
}