feat(LibreOffice): allow setting document server URI
All checks were successful
gitea-sync/antosdk-apps/pipeline/head This commit looks good

This commit is contained in:
Dany LE 2023-07-17 18:27:29 +02:00
parent 3b14ff5b9f
commit d8d38f5b05
11 changed files with 40 additions and 19 deletions

View File

@ -9,6 +9,8 @@ It support a wide range of documents.
![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true) ![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true)
## Change log ## Change log
- v 0.1.5-a:
* allow user to configure document server URI
- v 0.1.4-a: - v 0.1.4-a:
* Update backend script to latest API changes * Update backend script to latest API changes
* use luasocket + luasec to fetch LibreOffice service discovery * use luasocket + luasec to fetch LibreOffice service discovery

View File

@ -9,6 +9,8 @@ It support a wide range of documents.
![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true) ![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true)
## Change log ## Change log
- v 0.1.5-a:
* allow user to configure document server URI
- v 0.1.4-a: - v 0.1.4-a:
* Update backend script to latest API changes * Update backend script to latest API changes
* use luasocket + luasec to fetch LibreOffice service discovery * use luasocket + luasec to fetch LibreOffice service discovery

File diff suppressed because one or more lines are too long

View File

@ -7,7 +7,7 @@
"author": "Dany LE", "author": "Dany LE",
"email": "contact@iohub.dev" "email": "contact@iohub.dev"
}, },
"version":"0.1.4-a", "version":"0.1.5-a",
"category":"Office", "category":"Office",
"icon":"icon.png", "icon":"icon.png",
"mimes":[ "mimes":[

View File

@ -5,6 +5,7 @@ namespace OS {
opendoc: "data:image/x-icon;base64,iVBORw0K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bc5JU8IRF6/CnpsfSXlr5iVsvw9VQa0Ox5eWRP0b/ZF9uqSII+7Nch+QwthJVSTUc31aUXqvN5npeE2Uexp/q5VQFfQkhCN9hquxZtb1f3PQzq+UQflCVK6bWcdCAboSQtHJMf/zHVV98pBt0Rnfmbx7TYWFZoC4A5m0oVh+mr2gP5viIpbUH7GIeAKcAilUPogQ6H9vqJuB8taGp9z88LJ/0H4BR3aNW1eB/4cAAAAASUVORK5CYII=" newdoc: "data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAABmklEQVRIie2Vv0tbURTHP+fmJTGpIYM/KEoUHItOEtIu6uTk2r9BcNMWuro62X9D6OTWIhp00baLCI2giKKYVoMtJtTE93JPhyLSpyavLxE69Due+73nwzn3nnvhkSX+wNut2pugm9XapdkXicO/A3ysaZDk3UnD9yt77KETs9mOg4d8Jkiy+9TTCc8HIpmoSH7xU3Wo7QCA3k5DLtMY0hIgCKRlwB8QI6v+NSds0sKZpXBm/eFBf6AtFTTSf0BThT5kvxRw620G1FUREQxwUraUa3c9LbXoa0XZLbkUSpYBd4Pp+Bz6eTQJoPo7d0sVVD14FZ8mbc5JU8IRF6/CnpsfSXlr5iVsvw9VQa0Ox5eWRP0b/ZF9uqSII+7Nch+QwthJVSTUc31aUXqvN5npeE2Uexp/q5VQFfQkhCN9hquxZtb1f3PQzq+UQflCVK6bWcdCAboSQtHJMf/zHVV98pBt0Rnfmbx7TYWFZoC4A5m0oVh+mr2gP5viIpbUH7GIeAKcAilUPogQ6H9vqJuB8taGp9z88LJ/0H4BR3aNW1eB/4cAAAAASUVORK5CYII="
} }
const DEFAULT_LOO_URL = "https://loo.iohub.dev/hosting/discovery";
/** /**
* *
* @class LibreOffice * @class LibreOffice
@ -21,7 +22,6 @@ namespace OS {
private mimes: string[]; private mimes: string[];
private current_mode: string; private current_mode: string;
static discovery_uri: string;
constructor(args: AppArgumentsType[]) { constructor(args: AppArgumentsType[]) {
super("LibreOffice", args); super("LibreOffice", args);
this.access_token = undefined; this.access_token = undefined;
@ -63,6 +63,10 @@ namespace OS {
this.create("slide"); this.create("slide");
} }
$(window).on("message", this.post_msg_handle); $(window).on("message", this.post_msg_handle);
if(!this.setting.loo_url)
{
this.setting.loo_url = DEFAULT_LOO_URL;
}
this.discover() this.discover()
.then((data) => .then((data) =>
{ {
@ -72,7 +76,7 @@ namespace OS {
}) })
.catch((e) =>{ .catch((e) =>{
this.error(__("Unable to discover LibreOffice service: {0}", e.toString()), e); this.error(__("Unable to discover LibreOffice service: {0}", e.toString()), e);
this.quit(true); //this.quit(true);
}); });
} }
menu(): OS.GUI.BasicItemType[]{ menu(): OS.GUI.BasicItemType[]{
@ -112,6 +116,28 @@ namespace OS {
default: default:
} }
} }
},
{
text: "__(Document server URI)",
onmenuselect: async (_) =>
{
try{
const data = await this.openDialog("PromptDialog", {
title: __("Document server URI"),
label: __("Please enter LOO discovery URI"),
value: this.setting.loo_url
});
this.setting.loo_url= data;
const meta = await this.discover();
this.editor_meta = meta;
if(this.curr_file)
this.open();
}
catch(e)
{
this.error(__("Unable to set new document server URI: {0}", e.toString()), e);
}
}
} }
] ]
} }
@ -262,7 +288,7 @@ namespace OS {
{ {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try{ try{
let xml_text = await LibreOffice.discovery_uri.asFileHandle().read(); let xml_text = await this.setting.loo_url.asFileHandle().read();
let parser = new DOMParser(); let parser = new DOMParser();
let xml_doc = parser.parseFromString(xml_text,"text/xml"); let xml_doc = parser.parseFromString(xml_text,"text/xml");
let apps = xml_doc.getElementsByTagName("app"); let apps = xml_doc.getElementsByTagName("app");
@ -469,6 +495,5 @@ namespace OS {
$(window).off("message",this.post_msg_handle); $(window).off("message",this.post_msg_handle);
} }
} }
LibreOffice.discovery_uri = "https://loo.iohub.dev/hosting/discovery";
} }
} }

View File

@ -7,7 +7,7 @@
"author": "Dany LE", "author": "Dany LE",
"email": "contact@iohub.dev" "email": "contact@iohub.dev"
}, },
"version":"0.1.4-a", "version":"0.1.5-a",
"category":"Office", "category":"Office",
"icon":"icon.png", "icon":"icon.png",
"mimes":[ "mimes":[

View File

@ -69,16 +69,6 @@
"dependencies": ["Antunnel@0.2.0-b"], "dependencies": ["Antunnel@0.2.0-b"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/AntunnelPlugins/build/release/AntunnelPlugins.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/AntunnelPlugins/build/release/AntunnelPlugins.zip"
}, },
{
"pkgname": "AntunnelTestClient",
"name": "AntunnelTestClient",
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/AntunnelTestClient/README.md",
"category": "Development",
"author": "Dany LE",
"version": "0.1.0-a",
"dependencies": ["Antunnel@0.2.1-b"],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/AntunnelTestClient/build/release/AntunnelTestClient.zip"
},
{ {
"pkgname": "Archive", "pkgname": "Archive",
"name": "Archive", "name": "Archive",
@ -275,7 +265,7 @@
"description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/LibreOffice/README.md", "description": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/LibreOffice/README.md",
"category": "Office", "category": "Office",
"author": "Dany LE", "author": "Dany LE",
"version": "0.1.4-a", "version": "0.1.5-a",
"dependencies": [], "dependencies": [],
"download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/LibreOffice/build/release/LibreOffice.zip" "download": "https://raw.githubusercontent.com/lxsang/antosdk-apps/2.0.x/LibreOffice/build/release/LibreOffice.zip"
}, },

View File

@ -9,6 +9,8 @@ It support a wide range of documents.
![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true) ![https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true](https://github.com/lxsang/antosdk-apps/blob/master/LibreOffice/libreoffice.png?raw=true)
## Change log ## Change log
- v 0.1.5-a:
* allow user to configure document server URI
- v 0.1.4-a: - v 0.1.4-a:
* Update backend script to latest API changes * Update backend script to latest API changes
* use luasocket + luasec to fetch LibreOffice service discovery * use luasocket + luasec to fetch LibreOffice service discovery

Binary file not shown.

File diff suppressed because one or more lines are too long