From 2987d121657c3e9157b02d3649fa63e178e232f7 Mon Sep 17 00:00:00 2001 From: Xuan Sang LE Date: Wed, 10 Feb 2021 21:05:56 +0100 Subject: [PATCH] update OnlyOffice --- OnlyOffice/README.md | 2 ++ OnlyOffice/build/debug/README.md | 2 ++ OnlyOffice/build/debug/main.js | 2 +- OnlyOffice/build/debug/package.json | 2 +- OnlyOffice/build/release/OnlyOffice.zip | Bin 60519 -> 60587 bytes OnlyOffice/coffees/main.coffee | 3 ++- OnlyOffice/package.json | 2 +- packages.json | 2 +- 8 files changed, 10 insertions(+), 5 deletions(-) diff --git a/OnlyOffice/README.md b/OnlyOffice/README.md index 8ae00de..25788f9 100644 --- a/OnlyOffice/README.md +++ b/OnlyOffice/README.md @@ -8,3 +8,5 @@ Integrate OnlyOffice to an virtual window environment like AntOs allows an incon way to work with multiple document at the same time +## Change log +- v 0.1.1a: generate document key based on username and file path \ No newline at end of file diff --git a/OnlyOffice/build/debug/README.md b/OnlyOffice/build/debug/README.md index 8ae00de..25788f9 100644 --- a/OnlyOffice/build/debug/README.md +++ b/OnlyOffice/build/debug/README.md @@ -8,3 +8,5 @@ Integrate OnlyOffice to an virtual window environment like AntOs allows an incon way to work with multiple document at the same time +## Change log +- v 0.1.1a: generate document key based on username and file path \ No newline at end of file diff --git a/OnlyOffice/build/debug/main.js b/OnlyOffice/build/debug/main.js index 8496897..ee246ce 100644 --- a/OnlyOffice/build/debug/main.js +++ b/OnlyOffice/build/debug/main.js @@ -1 +1 @@ -(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=>e.error?this.error(e.error):(this.access_token=e.result,this.currfile.onready().then(e=>{var t;return t=(t=`${this.systemsetting.user.username}:${this.currfile.path}:${e.mtime}`).hash().toString(),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:t,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):(this.currfile=i.asFileHandle(),this.open())).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); \ No newline at end of file +(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=>e.error?this.error(e.error):(this.access_token=e.result,this.currfile.onready().then(e=>{var t;return t=(t=`${this.systemsetting.user.username}:${this.currfile.path}`).hash().toString(),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:t,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):(this.currfile=i.asFileHandle(),this.open())).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); \ No newline at end of file diff --git a/OnlyOffice/build/debug/package.json b/OnlyOffice/build/debug/package.json index cbd0496..204cbd5 100644 --- a/OnlyOffice/build/debug/package.json +++ b/OnlyOffice/build/debug/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version":"0.1.0-a", + "version":"0.1.1-a", "category":"Other", "icon":"icon.png", "mimes":[ diff --git a/OnlyOffice/build/release/OnlyOffice.zip b/OnlyOffice/build/release/OnlyOffice.zip index 8044b672b56b848b11fad2b21da2ecfdd5082846..7ba76a6f12766df23a17b75d9e758411035cc8c3 100644 GIT binary patch delta 507 zcmaEUgL(B$W}X0VW)?065LmomBab0B)8Yl2?YWn;b1Yuq6{PU?w#VjoLL!WehMSp1 z7BlgJ1hc=*PdUuUz;Jl;X0aB=Xk}#u=ZwU>^i+kM{B$l|g)#*LJwrXiL@R~#)V$Q9 z#FA8nl>Fq<+|;}hh3wQyg`~vd)D(sMJcZKY)S|q^+*F0cycC7B%$!t(g2a*xWcO@# zmdIjeTC!mBdTBKvwfVYqk`9Qr_Fygs(GI)i10^7# z1mXw)@h52phLY6Wf*ha+i}eG%8JR>FAS!?k(t9n#BqcN1=d}{Zc?GX!80#kYzE+k8 z8R>4gA^e>z0|N+)K#hh_&6CeV)jW;fDsvDh2*MmFY8Foxd?Rj;;#r`F*-_MV-C|(K bP0Y;G%PJ1=W@Q7(aRXr;69a?zD-aI=vI(4f delta 441 zcmZ2|lll1#W}X0VW)?065LiBSBab0B)AFgC?YWn;b1a|g6%_O1@YT)lghUt_4K_22 zEN0>b2^#I3cDsa;fuUscX0aAVBm-7V-8@Mmi8Hz&?%EuUzvcY z=vT&Y2Th*#$_UjVldrzg0vXHrT87blvfOJa5Xb7ZjMZXkpfgi*3vv=mQj7HiycwB9 z7$BZq0kl1T!MFWJIt&aTECLP!7;##9@`Tq)@*qWje@xH4T*SZt!l;V$CtrN6tN>Eu zZnz=*oh$hh PwDsifH&SeuUxGLQCy|Rp diff --git a/OnlyOffice/coffees/main.coffee b/OnlyOffice/coffees/main.coffee index da3c01f..ef367b0 100644 --- a/OnlyOffice/coffees/main.coffee +++ b/OnlyOffice/coffees/main.coffee @@ -79,7 +79,8 @@ class OnlyOffice extends this.OS.application.BaseApplication @access_token = d.result @currfile.onready() .then (meta) => - key = "#{@systemsetting.user.username}:#{@currfile.path}:#{meta.mtime}" + key = "#{@systemsetting.user.username}:#{@currfile.path}" + # :#{meta.mtime} key = key.hash().toString() @scheme.apptitle = @currfile.path $(@placeholder).empty() diff --git a/OnlyOffice/package.json b/OnlyOffice/package.json index cbd0496..204cbd5 100644 --- a/OnlyOffice/package.json +++ b/OnlyOffice/package.json @@ -7,7 +7,7 @@ "author": "Xuan Sang LE", "email": "mrsang@iohub.dev" }, - "version":"0.1.0-a", + "version":"0.1.1-a", "category":"Other", "icon":"icon.png", "mimes":[ diff --git a/packages.json b/packages.json index 9036a29..23f1ce5 100644 --- a/packages.json +++ b/packages.json @@ -155,7 +155,7 @@ "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/README.md", "category": "Other", "author": "Xuan Sang LE", - "version": "0.1.0-a", + "version": "0.1.1-a", "dependencies": [], "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/master/OnlyOffice/build/release/OnlyOffice.zip" },