1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00
This commit is contained in:
lxsang 2019-12-15 12:13:04 +01:00
parent 4cc896c1e1
commit 4af1130c5c
3 changed files with 48 additions and 61 deletions

View File

@ -1,7 +1,7 @@
BUILDDIR = ./build BUILDDIR = ./build
projs = grs info blog apps os projs = grs info blog apps os
copyfiles = index.ls mimes.json copyfiles = index.ls mimes.json
main: clean copy main: copy
for f in $(projs); do make -C "$${f}" ; done for f in $(projs); do make -C "$${f}" ; done
copy: copy:

View File

@ -1,8 +1,6 @@
// Generated by CoffeeScript 1.12.7 // Generated by CoffeeScript 2.4.1
(function() { (function() {
var APIManager, BaseObject, MarkOn, WebVNC, require, var APIManager, BaseObject, MarkOn, WebVNC, require;
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
window.classes = {}; window.classes = {};
@ -21,7 +19,6 @@
return window.classes[n] = o; return window.classes[n] = o;
}; };
/* /*
window.require = (lib) -> window.require = (lib) ->
return new Promise (r, e) -> return new Promise (r, e) ->
@ -31,9 +28,8 @@
window.libraries[lib] = true window.libraries[lib] = true
r() r()
.fail (m, s) -> .fail (m, s) ->
e(m, s) e(m, s) */
*/ // private function
require = function(lib) { require = function(lib) {
return new Promise(function(r, e) { return new Promise(function(r, e) {
if (window.libraries[lib]) { if (window.libraries[lib]) {
@ -48,24 +44,24 @@
}); });
}; };
BaseObject = (function() { BaseObject = class BaseObject {
function BaseObject(name) { constructor(name) {
this.name = name; this.name = name;
} }
BaseObject.prototype.ready = function() { ready() {
var me; var me;
me = this; me = this;
return new Promise(function(r, e) { return new Promise(function(r, e) {
return me.resolveDep().then(function() { return me.resolveDep().then(function() {
return r(); return r();
})["catch"](function(m, s) { }).catch(function(m, s) {
return e(m, s); return e(m, s);
}); });
}); });
}; }
BaseObject.prototype.resolveDep = function() { resolveDep() {
var me; var me;
me = this; me = this;
return new Promise(function(r, e) { return new Promise(function(r, e) {
@ -80,29 +76,25 @@
} }
return require(l[i]).then(function() { return require(l[i]).then(function() {
return fn(l, i + 1); return fn(l, i + 1);
})["catch"](function(m, s) { }).catch(function(m, s) {
return e(m, s); return e(m, s);
}); });
}; };
return fn(dep, 0); return fn(dep, 0);
}); });
}
}; };
return BaseObject;
})();
makeclass("BaseObject", BaseObject); makeclass("BaseObject", BaseObject);
APIManager = (function(superClass) { APIManager = class APIManager extends window.classes.BaseObject {
extend(APIManager, superClass); constructor(args1) {
super("APIManager");
function APIManager(args1) {
this.args = args1; this.args = args1;
APIManager.__super__.constructor.call(this, "APIManager");
} }
APIManager.prototype.init = function() { init() {
var cname, me; var cname, me;
me = this; me = this;
if (!(this.args && this.args.length > 0)) { if (!(this.args && this.args.length > 0)) {
@ -113,6 +105,7 @@
if (mobilecheck()) { if (mobilecheck()) {
mobileConsole.init(); mobileConsole.init();
} }
// load the class
if (!cname || cname === "") { if (!cname || cname === "") {
return; return;
} }
@ -120,67 +113,60 @@
return console.error("Cannot find class ", cname); return console.error("Cannot find class ", cname);
} }
return (new window.classes[cname](me.args)).init(); return (new window.classes[cname](me.args)).init();
})["catch"](function(m, s) { }).catch(function(m, s) {
return console.error(m, s); return console.error(m, s);
}); });
}
}; };
return APIManager;
})(window.classes.BaseObject);
APIManager.dependencies = ["/assets/scripts/mobile_console.js"]; APIManager.dependencies = ["/assets/scripts/mobile_console.js"];
makeclass("APIManager", APIManager); makeclass("APIManager", APIManager);
MarkOn = (function(superClass) { MarkOn = class MarkOn extends window.classes.BaseObject {
extend(MarkOn, superClass); constructor() {
super("MarkOn");
function MarkOn() {
MarkOn.__super__.constructor.call(this, "MarkOn");
} }
MarkOn.prototype.init = function() { init() {
var me; var me;
me = this; me = this;
return this.ready().then(function() { return this.ready().then(function() {
return me.editor = new SimpleMDE({ return me.editor = new SimpleMDE({
element: $("#editor")[0] element: $("#editor")[0]
}); });
})["catch"](function(m, s) { }).catch(function(m, s) {
return console.error(m, s); return console.error(m, s);
}); });
}
}; };
return MarkOn;
})(window.classes.BaseObject);
MarkOn.dependencies = ["/rst/gscripts/mde/simplemde.min.js"]; MarkOn.dependencies = ["/rst/gscripts/mde/simplemde.min.js"];
makeclass("MarkOn", MarkOn); makeclass("MarkOn", MarkOn);
WebVNC = (function(superClass) { WebVNC = class WebVNC extends window.classes.BaseObject {
extend(WebVNC, superClass); constructor() {
super("WebVNC");
function WebVNC() {
WebVNC.__super__.constructor.call(this, "WebVNC");
} }
WebVNC.prototype.init = function() { init() {
var me; var me;
me = this; me = this;
return this.ready().then(function() { return this.ready().then(function() {
return me.initVNCClient(); return me.initVNCClient();
})["catch"](function(m, s) { }).catch(function(m, s) {
return console.error(m, s); return console.error(m, s);
}); });
}; }
WebVNC.prototype.initVNCClient = function() { initVNCClient() {
var args, me; var args, me;
args = { args = {
element: 'canvas', element: 'canvas',
//ws: 'wss://localhost:9192/wvnc',
ws: 'wss://lxsang.me/wvnc', ws: 'wss://lxsang.me/wvnc',
worker: '/assets/scripts/decoder.js' worker: '/assets/scripts/decoder.js'
}; };
@ -219,15 +205,15 @@
value = Number(this.value) / 100; value = Number(this.value) / 100;
return me.client.setScale(value); return me.client.setScale(value);
}); });
})["catch"](function(m, s) { //$("#btclipboard").click (e) ->
// me.client.sendTextAsClipboard ($ "#clipboard")[0].value
}).catch(function(m, s) {
return console.error(m, s); return console.error(m, s);
}); });
}
}; };
return WebVNC;
})(window.classes.BaseObject);
WebVNC.dependencies = ["/assets/scripts/wvnc.js"]; WebVNC.dependencies = ["/assets/scripts/wvnc.js"];
makeclass("WebVNC", WebVNC); makeclass("WebVNC", WebVNC);

View File

@ -117,13 +117,14 @@ vfs.write = function(path,data)
if header ~= nil then if header ~= nil then
local b64data = string.gsub(data, header,"") local b64data = string.gsub(data, header,"")
local barr = std.b64decode(b64data) local barr = std.b64decode(b64data)
if std.isBinary(osfile) then
bytes.write(barr,osfile) bytes.write(barr,osfile)
--[[ if std.isBinary(osfile) then
else else
local f = io.open(osfile, "w") local f = io.open(osfile, "w")
f:write(bytes.__tostring(barr)) f:write(bytes.__tostring(barr))
f:close() f:close()
end end ]]
else else
return false, "Wrong data format" return false, "Wrong data format"
end end