chore: migrate and structure cmbone project
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
type SystemInfo struct{}
|
||||
|
||||
func NewSystemInfo() *SystemInfo {
|
||||
return &SystemInfo{}
|
||||
}
|
||||
|
||||
func (s *SystemInfo) GetOS() string {
|
||||
return runtime.GOOS // 返回 "darwin" / "windows" / "linux"
|
||||
}
|
||||
|
||||
func defaultHotkeysSQL() string {
|
||||
var sqlhotkeys = `
|
||||
INSERT INTO hotkeys (keycode, modifiers, description, target)
|
||||
SELECT 80, 1, '剪贴板窗口快捷键', '1'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM hotkeys WHERE target = '1');
|
||||
|
||||
INSERT INTO hotkeys (keycode, modifiers, description, target)
|
||||
SELECT 77, 1, '偏好设置快捷键 ', '2'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM hotkeys WHERE target = '2'); `
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
sqlhotkeys = `
|
||||
INSERT INTO hotkeys (keycode, modifiers, description, target)
|
||||
SELECT 34, 768, '剪贴板窗口快捷键', '1'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM hotkeys WHERE target = '1');
|
||||
|
||||
INSERT INTO hotkeys (keycode, modifiers, description, target)
|
||||
SELECT 46, 768, '偏好设置快捷键 ', '2'
|
||||
WHERE NOT EXISTS (SELECT 1 FROM hotkeys WHERE target = '2'); `
|
||||
}
|
||||
return sqlhotkeys
|
||||
}
|
||||
|
||||
func defaultAppConfigSQL() string {
|
||||
return `
|
||||
INSERT OR IGNORE INTO appconfig (key, type, value, description)
|
||||
VALUES ('language', 'system', 'zh', '应用语言,支持 zh/en');`
|
||||
}
|
||||
Reference in New Issue
Block a user