mirror of
https://github.com/antos-rde/antosdk-apps.git
synced 2024-12-25 19:58:21 +01:00
add IOHub mail
This commit is contained in:
parent
d39d10d78a
commit
fd38acfc02
3
IOMail/README.md
Normal file
3
IOMail/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# IOMail
|
||||
|
||||
Simple Mail client wrapper for https://mail.iohub.dev/
|
5
IOMail/assets/scheme.html
Normal file
5
IOMail/assets/scheme.html
Normal file
@ -0,0 +1,5 @@
|
||||
<afx-app-window apptitle="__(IOHub mail client)" width="700" height="500" data-id="IOMail">
|
||||
<afx-hbox >
|
||||
<iframe src="https://mail.iohub.dev"></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
3
IOMail/build/debug/README.md
Normal file
3
IOMail/build/debug/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# IOMail
|
||||
|
||||
Simple Mail client wrapper for https://mail.iohub.dev/
|
1
IOMail/build/debug/main.js
Normal file
1
IOMail/build/debug/main.js
Normal file
@ -0,0 +1 @@
|
||||
(function(){var i;(i=class extends this.OS.application.BaseApplication{constructor(i){super("IOMail",i)}main(){}}).singleton=!0,this.OS.register("IOMail",i)}).call(this);
|
16
IOMail/build/debug/package.json
Normal file
16
IOMail/build/debug/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"pkgname": "IOMail",
|
||||
"app":"IOMail",
|
||||
"name":"IOHub mail",
|
||||
"description":"IOHub mail",
|
||||
"info":{
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-envelope",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
5
IOMail/build/debug/scheme.html
Normal file
5
IOMail/build/debug/scheme.html
Normal file
@ -0,0 +1,5 @@
|
||||
<afx-app-window apptitle="__(IOHub mail client)" width="700" height="500" data-id="IOMail">
|
||||
<afx-hbox >
|
||||
<iframe src="https://mail.iohub.dev"></iframe>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
BIN
IOMail/build/release/IOMail.zip
Normal file
BIN
IOMail/build/release/IOMail.zip
Normal file
Binary file not shown.
9
IOMail/coffees/main.coffee
Normal file
9
IOMail/coffees/main.coffee
Normal file
@ -0,0 +1,9 @@
|
||||
class IOMail extends this.OS.application.BaseApplication
|
||||
constructor: ( args ) ->
|
||||
super "IOMail", args
|
||||
|
||||
main: () ->
|
||||
|
||||
IOMail.singleton = true
|
||||
|
||||
this.OS.register "IOMail", IOMail
|
16
IOMail/package.json
Normal file
16
IOMail/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"pkgname": "IOMail",
|
||||
"app":"IOMail",
|
||||
"name":"IOHub mail",
|
||||
"description":"IOHub mail",
|
||||
"info":{
|
||||
"author": "",
|
||||
"email": ""
|
||||
},
|
||||
"version":"0.1.0-a",
|
||||
"category":"Other",
|
||||
"iconclass":"fa fa-envelope",
|
||||
"mimes":["none"],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
7
IOMail/project.json
Normal file
7
IOMail/project.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"name": "IOMail",
|
||||
"css": [],
|
||||
"javascripts": [],
|
||||
"coffees": ["coffees/main.coffee"],
|
||||
"copies": ["assets/scheme.html", "package.json", "README.md"]
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
# OnlyOffice
|
||||
|
||||
This application is the front-end connector of the OnlyOffice suite.
|
||||
It needs to connect to a working OnlyOffice document server.
|
||||
|
||||
The application allows to open/edit commons document, presentation, and spreedsheet.
|
||||
Integrate OnlyOffice to an virtual window environment like AntOs allows an inconvenient
|
||||
way to work with multiple documents at the same time.
|
||||
|
||||
![https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/OnlyOffice/screenshot.png?raw=true)
|
||||
|
||||
## Change log
|
||||
- v 0.1.3a: Let backend generates document key, compatible with doc.iohub.dev/office
|
||||
- v 0.1.2a: generate document key based on username, file path and modified time
|
||||
- v 0.1.1a: generate document key based on username and file path
|
@ -1,87 +0,0 @@
|
||||
local args=...
|
||||
local web = require("web")
|
||||
local vfs = require("vfs")
|
||||
|
||||
if not args then
|
||||
args = REQUEST
|
||||
end
|
||||
|
||||
local result = function(data)
|
||||
return {
|
||||
error = false,
|
||||
result = data
|
||||
}
|
||||
end
|
||||
|
||||
local error = function(data)
|
||||
return {
|
||||
error = data,
|
||||
result = false
|
||||
}
|
||||
end
|
||||
|
||||
local handle = {}
|
||||
|
||||
handle.token = function(data)
|
||||
local file = vfs.ospath(data.file)
|
||||
local stat = ulib.file_stat(file)
|
||||
local ret = {
|
||||
sid = "sessionid="..SESSION.sessionid,
|
||||
key = std.sha1(file..":"..stat.mtime)
|
||||
}
|
||||
return result(ret)
|
||||
end
|
||||
|
||||
handle.duplicate = function(data)
|
||||
local file = vfs.ospath(data.as)
|
||||
local tmpfile = "/tmp/"..std.sha1(file)
|
||||
local cmd = "curl -o "..tmpfile..' "'..data.remote..'"'
|
||||
os.execute(cmd)
|
||||
-- move file to correct position
|
||||
if ulib.exists(tmpfile) then
|
||||
cmd = "mv "..tmpfile.." "..file
|
||||
os.execute(cmd)
|
||||
print("File "..file.." is duplicated with remote")
|
||||
else
|
||||
return error("Unable to duplicate file")
|
||||
end
|
||||
return result("File duplicated")
|
||||
end
|
||||
|
||||
handle.save = function()
|
||||
--print(JSON.encode(REQUEST))
|
||||
if not REQUEST.json then
|
||||
return error("Invalid request")
|
||||
end
|
||||
local data = JSON.decodeString(REQUEST.json)
|
||||
if not data then
|
||||
return error("Invalid request")
|
||||
end
|
||||
if not REQUEST.file then
|
||||
return error("No file found")
|
||||
end
|
||||
local file = vfs.ospath(REQUEST.file)
|
||||
if data.status == 2 then
|
||||
local tmpfile = "/tmp/"..std.sha1(file)
|
||||
local cmd = "curl -o "..tmpfile..' "'..data.url..'"'
|
||||
os.execute(cmd)
|
||||
-- move file to correct position
|
||||
if ulib.exists(tmpfile) then
|
||||
cmd = "mv "..tmpfile.." "..file
|
||||
os.execute(cmd)
|
||||
print("File "..file.." sync with remote")
|
||||
else
|
||||
return error("Unable to download")
|
||||
end
|
||||
end
|
||||
|
||||
return result("OK")
|
||||
end
|
||||
|
||||
--print(JSON.encode(args))
|
||||
|
||||
if args.action and handle[args.action] then
|
||||
return handle[args.action](args.args)
|
||||
else
|
||||
return error("Invalid action parameter")
|
||||
end
|
Binary file not shown.
Before Width: | Height: | Size: 2.8 KiB |
@ -1,9 +0,0 @@
|
||||
|
||||
afx-app-window[data-id="OnlyOffice"] div[data-id="editor-area"] p{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
afx-app-window[data-id="OnlyOffice"] div[data-id="editor-area"] button {
|
||||
width: 250px;
|
||||
|
||||
}
|
@ -1 +0,0 @@
|
||||
(function(){var e;(e=class extends this.OS.application.BaseApplication{constructor(e){super("OnlyOffice",e),this.eid="id"+Math.random().toString(36).replace(".","")}main(){if(this.currfile=void 0,this.args&&this.args.length>0&&(this.currfile=this.args[0].path.asFileHandle()),this.placeholder=this.find("editor-area"),this.placeholder.id=this.eid,this.find("btn-open-file").onbtclick=e=>this.openFile(),this.find("btn-new-doc").onbtclick=e=>this.create("word"),this.find("btn-new-cell").onbtclick=e=>this.create("sheet"),this.find("btn-new-slide").onbtclick=e=>this.create("slide"),this.currfile)return this.open()}create(e){var t;return t=void 0,"word"===e&&(t="docx"),"sheet"===e&&(t="xlsx"),"slide"===e&&(t="pptx"),t?this.openDialog("FileDialog",{title:__("Save file as"),type:"dir",file:("home://Untitled."+t).asFileHandle()}).then(e=>{var i,s;return i=`${e.file.path}/${e.name}`.asFileHandle(),(s=`${this.path()}/templates/model.${t}`.asFileHandle()).read("binary").then(e=>{var t;return t=new Blob([e],{type:s.info.mime}),i.cache=t,i.write(s.info.mime).then(e=>(i.cache=void 0,this.currfile=i,this.open())).catch(e=>this.error(e.toString(),e))}).catch(e=>this.error(e.toString(),e))}):this.error(__("Unkown file type"))}openFile(){return this.openDialog("FileDialog",{title:__("Open file"),type:"file",mimes:this.meta().mimes}).then((e,t)=>(this.currfile=e.file.path.asFileHandle(),this.open()))}editorReady(){return console.log($('iframe[name="frameEditor"]',this.scheme).contents())}open(){if(this.currfile)return this.exec("token",{file:this.currfile.path}).then(e=>(console.log(e),e.error?this.error(e.error):(this.access_token=e.result.sid,this.currfile.onready().then(t=>(this.scheme.apptitle=this.currfile.path,$(this.placeholder).empty(),this.editor&&this.editor.destroyEditor(),this.editor=new DocsAPI.DocEditor(this.eid,{events:{onAppReady:e=>this.editorReady(e),onRequestCreateNew:()=>this.newDocument(),onRequestSaveAs:e=>this.saveAs(e)},document:{fileType:this.currfile.ext,key:e.result.key,title:this.currfile.filename,url:this.currfile.getlink()+"?"+this.access_token},documentType:this.getDocType(this.currfile.ext),editorConfig:{user:{id:this.systemsetting.user.id.toString(),name:this.systemsetting.user.username},customization:{compactHeader:!1},callbackUrl:this.uapi("save")}})))))).catch(e=>this.error(e.toString(),e))}getDocType(e){return"doc,docx,epub,odt".split(",").includes(e)?"word":"csv,ods,xls,xlsx".split(",").includes(e)?"cell":"odp,ppt,pptx".split(",").includes(e)?"slide":"none"}saveAs(e){if(e.data.url)return e.data.url.asFileHandle(),this.openDialog("FileDialog",{title:__("Save file as"),type:"dir",file:("home://"+e.data.title).asFileHandle()}).then(t=>{var i;return i=`${t.file.path}/${t.name}`,this.exec("duplicate",{remote:e.data.url,as:i}).then(e=>e.error?this.error(e.error):"none"!==this.getDocType(i.asFileHandle().ext)?(this.currfile=i.asFileHandle(),this.open()):void 0).catch(e=>this.error(e.toString(),e))})}newDocument(){return this.openDialog("SelectionDialog",{title:__("Create new"),data:[{text:__("Open a file"),iconclass:"fa fa-folder-open",type:"open"},{text:__("Document"),iconclass:"fa fa-file-word-o",type:"word"},{text:__("Spreadsheet"),iconclass:"fa fa-file-excel-o",type:"sheet"},{text:__("Presentation"),iconclass:"fa fa-file-powerpoint-o",type:"slide"}]}).then(e=>{switch(e.type){case"open":return this.openFile();default:return this.create(e.type)}})}uapi(e){return`${this._api.REST}/system/apigateway?ws=0&path=${this.path()}/api.lua&action=${e}&file=${this.currfile.path}&${this.access_token}`}exec(e,t){var i;return i={path:this.path()+"/api.lua",parameters:{action:e,args:t}},this.call(i)}cleanup(){return this.editor&&this.editor.destroyEditor(),this.editor=void 0}}).dependencies=["https://office.iohub.dev/web-apps/apps/api/documents/api.js"],this.OS.register("OnlyOffice",e),this.extensionParams={url:"https://office.iohub.dev/web-apps/"}}).call(this);
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"pkgname": "OnlyOffice",
|
||||
"app":"OnlyOffice",
|
||||
"name":"Office Suite",
|
||||
"description":"Online Office suite based on OnlyOffice",
|
||||
"info":{
|
||||
"author": "Xuan Sang LE",
|
||||
"email": "mrsang@iohub.dev"
|
||||
},
|
||||
"version":"0.1.3-a",
|
||||
"category":"Other",
|
||||
"icon":"icon.png",
|
||||
"mimes":[
|
||||
"application/vnd.oasis.opendocument.text",
|
||||
"application/vnd.oasis.opendocument.spreadsheet",
|
||||
"application/vnd.oasis.opendocument.presentation",
|
||||
"application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
||||
"application/msword",
|
||||
"application/vnd.ms-excel",
|
||||
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
||||
"application/vnd.ms-powerpoint",
|
||||
"application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
||||
"application/epub+zip"
|
||||
],
|
||||
"dependencies":[],
|
||||
"locale": {}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
<afx-app-window apptitle="Office Suite" width="700" height="500" data-id="OnlyOffice">
|
||||
<afx-hbox >
|
||||
<div data-id="editor-area" id='placeholder'>
|
||||
<p>
|
||||
<afx-button data-id="btn-open-file" text="__(Open file)" iconclass="fa fa-folder-open" ></afx-button>
|
||||
</p>
|
||||
<p>
|
||||
<afx-button data-id="btn-new-doc" text="__(Create Document)" iconclass="fa fa-file-word-o"></afx-button>
|
||||
</p>
|
||||
<p>
|
||||
<afx-button data-id="btn-new-cell" text="__(Create Spreadsheet)" iconclass="fa fa-file-excel-o"></afx-button>
|
||||
</p>
|
||||
<p>
|
||||
<afx-button data-id="btn-new-slide" text="__(Create Presentation)" iconclass="fa fa-file-powerpoint-o"></afx-button>
|
||||
</p>
|
||||
</div>
|
||||
</afx-hbox>
|
||||
</afx-app-window>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -119,6 +119,16 @@
|
||||
"dependencies": [],
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/GraphEditor/build/release/GraphEditor.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "IOMail",
|
||||
"name": "IOHub mail",
|
||||
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/IOMail/README.md",
|
||||
"category": "Other",
|
||||
"author": "",
|
||||
"version": "0.1.0-a",
|
||||
"dependencies": [],
|
||||
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/IOMail/build/release/IOMail.zip"
|
||||
},
|
||||
{
|
||||
"pkgname": "Katex",
|
||||
"name": "Katex",
|
||||
|
Loading…
Reference in New Issue
Block a user