mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-07-21 00:09:45 +02:00
switch to es6 from coffeescript
This commit is contained in:
@ -1,105 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
Ant.OS.API.HOST = Ant.location.hostname + (if Ant.location.port then":#{Ant.location.port}" else "")
|
||||
Ant.OS.API.REST = "#{Ant.location.protocol}//#{Ant.OS.API.HOST}"
|
||||
|
||||
Ant.OS.API.handle =
|
||||
# get file, require authentification
|
||||
get: "#{Ant.OS.API.REST}/VFS/get"
|
||||
# get shared file with publish
|
||||
shared: "#{Ant.OS.API.REST}/VFS/shared"
|
||||
scandir: (p) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/scandir"
|
||||
Ant.OS.API.post path, { path: p }
|
||||
|
||||
mkdir: (p) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/mkdir"
|
||||
Ant.OS.API.post path, { path: p }
|
||||
|
||||
sharefile: (p, pub) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/publish"
|
||||
Ant.OS.API.post path, { path: p , publish: pub }
|
||||
|
||||
fileinfo: (p) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/fileinfo"
|
||||
Ant.OS.API.post path, { path: p }
|
||||
|
||||
readfile: (p, t) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/get/"
|
||||
Ant.OS.API.get path + p, t
|
||||
|
||||
move: (s, d) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/move"
|
||||
Ant.OS.API.post path, { src: s, dest: d }
|
||||
|
||||
delete: (p) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/delete"
|
||||
Ant.OS.API.post path, { path: p }
|
||||
|
||||
fileblob: (p) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/get/"
|
||||
Ant.OS.API.blob path + p
|
||||
|
||||
packages: (d) ->
|
||||
path = "#{Ant.OS.API.REST}/system/packages"
|
||||
Ant.OS.API.post path, d
|
||||
|
||||
upload: (d) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/upload"
|
||||
Ant.OS.API.upload path, d
|
||||
|
||||
write: (p, d) ->
|
||||
path = "#{Ant.OS.API.REST}/VFS/write"
|
||||
Ant.OS.API.post path, { path: p, data: d }
|
||||
|
||||
scanapp: (p, c ) ->
|
||||
path = "#{Ant.OS.API.REST}/system/application"
|
||||
|
||||
apigateway: (d, ws) ->
|
||||
if ws
|
||||
new Promise (resolve, reject) ->
|
||||
try
|
||||
path = "#{Ant.OS.API.HOST}/system/apigateway?ws=1"
|
||||
proto = if window.location.protocol is "https:" then "wss://" else "ws://"
|
||||
socket = new WebSocket proto + path
|
||||
resolve(socket)
|
||||
catch e
|
||||
reject __e e
|
||||
else
|
||||
path = "#{Ant.OS.API.REST}/system/apigateway?ws=0"
|
||||
Ant.OS.API.post path, d
|
||||
|
||||
auth: () ->
|
||||
p = "#{Ant.OS.API.REST}/user/auth"
|
||||
Ant.OS.API.post p, {}
|
||||
|
||||
login: (d) ->
|
||||
p = "#{Ant.OS.API.REST}/user/login"
|
||||
Ant.OS.API.post p, d
|
||||
|
||||
logout: () ->
|
||||
p = "#{Ant.OS.API.REST}/user/logout"
|
||||
Ant.OS.API.post p, {}
|
||||
|
||||
setting: () ->
|
||||
p = "#{Ant.OS.API.REST}/system/settings"
|
||||
Ant.OS.API.post p, Ant.OS.setting
|
||||
|
||||
dbquery: (cmd, d) ->
|
||||
path = "#{Ant.OS.API.REST}/VDB/#{cmd}"
|
||||
Ant.OS.API.post path, d
|
133
src/core/handles/RemoteHandle.js
Normal file
133
src/core/handles/RemoteHandle.js
Normal file
@ -0,0 +1,133 @@
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
// AnTOS Web desktop is is licensed under the GNU General Public
|
||||
// License v3.0, see the LICENCE file for more information
|
||||
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of
|
||||
// the License, or (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
//along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
Ant.OS.API.HOST = Ant.location.hostname + (Ant.location.port ?`:${Ant.location.port}` : "");
|
||||
Ant.OS.API.REST = `${Ant.location.protocol}//${Ant.OS.API.HOST}`;
|
||||
|
||||
Ant.OS.API.handle = {
|
||||
// get file, require authentification
|
||||
get: `${Ant.OS.API.REST}/VFS/get`,
|
||||
// get shared file with publish
|
||||
shared: `${Ant.OS.API.REST}/VFS/shared`,
|
||||
scandir(p) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/scandir`;
|
||||
return Ant.OS.API.post(path, { path: p });
|
||||
},
|
||||
|
||||
mkdir(p) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/mkdir`;
|
||||
return Ant.OS.API.post(path, { path: p });
|
||||
},
|
||||
|
||||
sharefile(p, pub) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/publish`;
|
||||
return Ant.OS.API.post(path, { path: p , publish: pub });
|
||||
},
|
||||
|
||||
fileinfo(p) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/fileinfo`;
|
||||
return Ant.OS.API.post(path, { path: p });
|
||||
},
|
||||
|
||||
readfile(p, t) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/get/`;
|
||||
return Ant.OS.API.get(path + p, t);
|
||||
},
|
||||
|
||||
move(s, d) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/move`;
|
||||
return Ant.OS.API.post(path, { src: s, dest: d });
|
||||
},
|
||||
|
||||
delete(p) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/delete`;
|
||||
return Ant.OS.API.post(path, { path: p });
|
||||
},
|
||||
|
||||
fileblob(p) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/get/`;
|
||||
return Ant.OS.API.blob(path + p);
|
||||
},
|
||||
|
||||
packages(d) {
|
||||
const path = `${Ant.OS.API.REST}/system/packages`;
|
||||
return Ant.OS.API.post(path, d);
|
||||
},
|
||||
|
||||
upload(d) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/upload`;
|
||||
return Ant.OS.API.upload(path, d);
|
||||
},
|
||||
|
||||
write(p, d) {
|
||||
const path = `${Ant.OS.API.REST}/VFS/write`;
|
||||
return Ant.OS.API.post(path, { path: p, data: d });
|
||||
},
|
||||
|
||||
scanapp(p, c ) {
|
||||
let path;
|
||||
return path = `${Ant.OS.API.REST}/system/application`;
|
||||
},
|
||||
|
||||
apigateway(d, ws) {
|
||||
if (ws) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
try {
|
||||
const path = `${Ant.OS.API.HOST}/system/apigateway?ws=1`;
|
||||
const proto = window.location.protocol === "https:" ? "wss://" : "ws://";
|
||||
const socket = new WebSocket(proto + path);
|
||||
return resolve(socket);
|
||||
} catch (e) {
|
||||
return reject(__e(e));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
const path = `${Ant.OS.API.REST}/system/apigateway?ws=0`;
|
||||
return Ant.OS.API.post(path, d);
|
||||
}
|
||||
},
|
||||
|
||||
auth() {
|
||||
const p = `${Ant.OS.API.REST}/user/auth`;
|
||||
return Ant.OS.API.post(p, {});
|
||||
},
|
||||
|
||||
login(d) {
|
||||
const p = `${Ant.OS.API.REST}/user/login`;
|
||||
return Ant.OS.API.post(p, d);
|
||||
},
|
||||
|
||||
logout() {
|
||||
const p = `${Ant.OS.API.REST}/user/logout`;
|
||||
return Ant.OS.API.post(p, {});
|
||||
},
|
||||
|
||||
setting() {
|
||||
const p = `${Ant.OS.API.REST}/system/settings`;
|
||||
return Ant.OS.API.post(p, Ant.OS.setting);
|
||||
},
|
||||
|
||||
dbquery(cmd, d) {
|
||||
const path = `${Ant.OS.API.REST}/VDB/${cmd}`;
|
||||
return Ant.OS.API.post(path, d);
|
||||
}
|
||||
};
|
@ -1,23 +0,0 @@
|
||||
# Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
# AnTOS Web desktop is is licensed under the GNU General Public
|
||||
# License v3.0, see the LICENCE file for more information
|
||||
|
||||
# This program is free software: you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
#along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
Ant.OS.API.handle =
|
||||
scandir: (p, c ) ->
|
||||
path = 'resources/jsons/scandir.json'
|
||||
Ant.OS.API.get path , c, (e, s) ->
|
||||
Ant.OS.announcer.osfail "System fall: Cannot read #{path}", e, s
|
||||
|
29
src/core/handles/TestHandle.js
Normal file
29
src/core/handles/TestHandle.js
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* decaffeinate suggestions:
|
||||
* DS102: Remove unnecessary code created because of implicit returns
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
|
||||
|
||||
// AnTOS Web desktop is is licensed under the GNU General Public
|
||||
// License v3.0, see the LICENCE file for more information
|
||||
|
||||
// This program is free software: you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of
|
||||
// the License, or (at your option) any later version.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
//along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
Ant.OS.API.handle = {
|
||||
scandir(p, c ) {
|
||||
const path = 'resources/jsons/scandir.json';
|
||||
return Ant.OS.API.get(path , c, (e, s) => Ant.OS.announcer.osfail(`System fall: Cannot read ${path}`, e, s));
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user