fix remote handler & terminal

This commit is contained in:
Xuan Sang LE 2018-02-02 22:18:33 +01:00
parent 6ea5857de2
commit 982793ea0c
4 changed files with 22 additions and 20 deletions

View File

@ -1,6 +1,6 @@
BUILDDIR = build/htdocs
BUILDDIR = build/htdocs/os
BLUE=\033[1;34m
NC=\033[0m

View File

@ -1,74 +1,77 @@
self.OS.API.handler =
get: "lua-api/fs/get"
self.OS.API.HOST = "127.0.0.1:9195"
self.OS.API.REST = "http://#{self.OS.API.HOST}/lua-api"
_REST = self.OS.API.REST
self.OS.API.handler =
get: "#{_REST}/fs/get/"
scandir: (p, c ) ->
path = "lua-api/fs/scandir"
path = "#{_REST}/fs/scandir"
_API.post path, { path: p }, c, (e, s) ->
_courrier.osfail "Fail to scan directory: #{p}", e, s
mkdir: (p, c ) ->
path = "lua-api/fs/mkdir"
path = "#{_REST}/fs/mkdir"
_API.post path, { path: p }, c, (e, s) ->
_courrier.osfail "Fail to create directory: #{p}", e, s
fileinfo: (p, c) ->
path = "lua-api/fs/fileinfo"
path = "#{_REST}/fs/fileinfo"
_API.post path, { path: p }, c, (e, s) ->
_courrier.osfail "Fail to get file metadata: #{p}", e, s
readfile: (p, c, t) ->
path = "lua-api/fs/get/"
path = "#{_REST}/fs/get/"
_API.get path + p, c, (e, s) ->
_courrier.osfail "Fail to read file: #{p}", e, s
, t
move: (s, d, c) ->
path = "lua-api/fs/move"
path = "#{_REST}/fs/move"
_API.post path, { src: s, dest: d }, c, (e, s) ->
_courrier.osfail "Fail to move file: #{s} -> #{d}", e, s
delete: (p , c) ->
path = "lua-api/fs/delete"
path = "#{_REST}/fs/delete"
_API.post path, { path: p }, c, (e, s) ->
_courrier.osfail "Fail to delete: #{p}", e, s
fileblob: (p, c) ->
path = "lua-api/fs/get/"
path = "#{_REST}/fs/get/"
_API.blob path + p, c, (e, s) ->
_courrier.osfail "Fail to read file: #{p}", e, s
packages: (d, c) ->
path = "lua-api/system/packages"
path = "#{_REST}/system/packages"
_API.post path, d, c, (e, s) ->
_courrier.osfail "Fail to #{d.command} package", e, s
upload: (d, c) ->
path = "lua-api/fs/upload"
path = "#{_REST}/fs/upload"
_API.upload path, d, c, (e, s) ->
_courrier.osfail "Fail to upload file to: #{d}", e, s
write: (p, d , c) ->
path = "lua-api/fs/write"
path = "#{_REST}/fs/write"
_API.post path, { path: p, data: d }, c, (e, s) ->
_courrier.osfail "Fail to write to file: #{p}", e, s
scanapp: (p, c ) ->
path = "lua-api/system/application"
path = "#{_REST}/system/application"
auth: (c) ->
p = "lua-api/system/auth"
p = "#{_REST}/system/auth"
_API.post p, {}, c, () ->
alert "Resource not found: #{p}"
login: (d, c) ->
p = "lua-api/system/login"
p = "#{_REST}/system/login"
_API.post p, d, c, () ->
alert "Resource not found: #{p}"
logout: () ->
p = "lua-api/system/logout"
p = "#{_REST}/system/logout"
_API.post p, {}, (d) ->
_OS.boot()
, () ->
alert "Resource not found #{p}"
setting: () ->
p = "lua-api/system/settings"
p = "#{_REST}/system/settings"
_API.post p, _OS.setting, (d) ->
_courrier.oserror "Cannot save system setting", d.error if d.error
, (e, s) ->

View File

@ -57,7 +57,7 @@ class wTerm extends this.OS.GUI.BaseApplication
me = @
@term.clear()
@term.focus()
@socket = new WebSocket "ws://" + window.location.host + "/wterm"
@socket = new WebSocket "ws://" + @_api.HOST + "/wterm"
@socket.onopen = () ->
#el.style.display = "none"
me.resizeContent (($ me.mterm).width()) , (($ me.mterm).height())

View File

@ -5129,4 +5129,3 @@ module.exports = Terminal;
},{"./BufferSet":2,"./CompositionHelper":4,"./EscapeSequences":5,"./EventEmitter":6,"./InputHandler":7,"./Linkifier":8,"./Parser":9,"./Renderer":10,"./SelectionManager":11,"./Viewport":13,"./handlers/Clipboard":14,"./utils/Browser":15,"./utils/BufferLine":16,"./utils/CharMeasure":17,"./utils/Mouse":21}]},{},[22])(22)
});
//# sourceMappingURL=xterm.js.map