antos-frontend/src/core/settings.coffee

73 lines
3.3 KiB
CoffeeScript
Raw Normal View History

2018-02-27 16:40:36 +01:00
self.OS.systemSetting = (conf) ->
_OS.setting.desktop = conf.desktop if conf.desktop
_OS.setting.applications = conf.applications if conf.applications
_OS.setting.appearance = conf.appearance if conf.appearance
2018-03-11 21:31:40 +01:00
_OS.setting.appearance.wp = {
2018-03-12 00:42:14 +01:00
url: "os://resources/themes/system/wp/wp2.jpg",
2018-03-11 21:31:40 +01:00
size: "cover",
repeat: "repeat"
} unless _OS.setting.appearance.wp
_OS.setting.appearance.wps = [] unless _OS.setting.appearance.wps
2018-02-27 16:40:36 +01:00
_OS.setting.user = conf.user
_OS.setting.VFS = conf.VFS if conf.VFS
2018-03-11 21:31:40 +01:00
_OS.setting.desktop.path = "home://.desktop" unless _OS.setting.desktop.path
2018-02-27 16:40:36 +01:00
_OS.setting.desktop.menu = {} unless _OS.setting.desktop.menu
_OS.setting.VFS.mountpoints = [
#TODO: multi app try to write to this object, it neet to be cloned
2018-03-12 23:20:06 +01:00
{ text: "__(Applications)", path: 'app://', iconclass: "fa fa-adn", type: "app" },
{ text: "__(Home)", path: 'home://', iconclass: "fa fa-home", type: "fs" },
{ text: "__Desktop)", path: _OS.setting.desktop.path , iconclass: "fa fa-desktop", type: "fs" },
{ text: "__(OS)", path: 'os://', iconclass: "fa fa-inbox", type: "fs" },
{ text: "__(Google Drive)", path: 'gdv://', iconclass: "fa fa-inbox", type: "fs" },
{ text: "__(Shared)", path: 'shared://' , iconclass: "fa fa-share-square", type: "fs" }
2018-02-27 16:40:36 +01:00
] if not _OS.setting.VFS.mountpoints
_OS.setting.system = conf.system if conf.system
2018-02-28 16:40:28 +01:00
_OS.setting.system.startup = {
services: [
"CoreServices/PushNotification",
"CoreServices/UserService",
"CoreServices/Calendar",
"CoreServices/Spotlight"
],
apps: []
} if not _OS.setting.system.startup
2018-03-05 00:20:25 +01:00
_OS.setting.system.pkgpaths = {
2018-03-11 21:31:40 +01:00
user: "home://.packages",
system: "os://packages"
2018-03-05 00:20:25 +01:00
} unless _OS.setting.system.pkgpaths
_OS.setting.system.locale = "en_GB" unless _OS.setting.system.locale
2018-02-27 16:40:36 +01:00
_OS.setting.system.menu = {} unless _OS.setting.system.menu
_OS.setting.system.repositories = [] unless _OS.setting.system.repositories
_OS.setting.appearance.theme = "antos" unless _OS.setting.appearance.theme
_OS.setting.VFS.gdrive = {
2018-02-28 15:50:49 +01:00
CLIENT_ID: ""
API_KEY: ""
2018-02-27 16:40:36 +01:00
apilink: "https://apis.google.com/js/api.js"
DISCOVERY_DOCS: ["https://www.googleapis.com/discovery/v1/apis/drive/v3/rest"]
2018-02-28 00:15:41 +01:00
SCOPES: 'https://www.googleapis.com/auth/drive'
2018-03-03 13:44:52 +01:00
} unless _OS.setting.VFS.gdrive
#search for app
_API.onsearch "__(Applications)", (t) ->
2018-03-03 13:44:52 +01:00
ar = []
term = new RegExp t, "i"
for k, v of _OS.setting.system.packages when v.app
if (v.name.match term) or (v.description and v.description.match term)
2018-03-03 14:33:05 +01:00
v1 = {}
v1[k1] = e for k1, e of v when k1 isnt "selected"
v1.detail = [{ text: v1.path }]
v1.complex = true
2018-03-03 14:33:05 +01:00
ar.push v1
2018-03-03 13:44:52 +01:00
else if v.mimes
for m in v.mimes
if t.match (new RegExp m, "g")
2018-03-03 14:33:05 +01:00
v1 = {}
v1[k1] = v[k1] for k1, e of v when k1 isnt "selected"
v1.detail = [{ text: v1.path }]
v1.complex = true
2018-03-03 14:33:05 +01:00
ar.push v1
2018-03-03 13:44:52 +01:00
break
return ar