add draft version of libreOffice

This commit is contained in:
DanyLE
2022-08-21 19:34:24 +02:00
parent 03f48f3211
commit 693c5b9e8a
20 changed files with 753 additions and 0 deletions

View File

@ -0,0 +1,15 @@
# Libre Office Onlie
This is an example project, generated by AntOS Development Kit
## Howto
Use the Antedit command palette to access to the SDK functionalities:
1. Create new project
2. Init the project from the current folder located in side bar
3. Build and run the project
4. Release the project in zip package
## Set up build target
Open the `build.json` file from the current project tree and add/remove
build target entries and jobs. Save the file

View File

@ -0,0 +1,82 @@
local args=...
if not args then
args = REQUEST
end
local vfs = require("vfs")
local DLCMD="wget --no-check-certificate -O"
local handle = {}
local result = function(data)
return { error = false, result = data }
end
local error = function(msg)
return {error = msg, result = false}
end
handle.token = function(data)
local file = vfs.ospath(data.file)
local stat = ulib.file_stat(file)
local ret = {
sid = "access_token="..SESSION.sessionid,
key = std.sha1(file..":"..stat.mtime)
}
return result(ret)
end
handle.discover = function(data)
local tmpfile = "/tmp/libreoffice_discover.xml"
local cmd = DLCMD.." "..tmpfile..' '..data.uri
os.execute(cmd)
-- move file to correct position
if ulib.exists(tmpfile) then
local f = assert(io.open(tmpfile, "rb"))
local content = f:read("*all")
f:close()
return result(content)
else
return error("Unable to discover data")
end
end
handle.file = function(data)
local rq = REQUEST.r
if not rq then
return error("Unknown request")
end
local ret, stat = vfs.fileinfo(data.file)
if not ret then
return error("Unable to query file info")
end
local path = vfs.ospath(data.file)
if rq:match("/wopi/files/[^/]*/contents$") then
if REQUEST.method == "GET" then
std.sendFile(path)
return nil
elseif REQUEST.method == "POST" then
local clen = tonumber(HEADER['Content-Length'])
local barr = bytes.unew(REQUEST["octet-stream"],clen)
bytes.write(barr, path)
return result(true)
else
return error("Unknown request method")
end
elseif rq:match("/wopi/files/[^/]*$") then
return {
BaseFileName = stat.name,
Size = math.floor(stat.size),
UserCanWrite = vfs.checkperm(data.file,"write"),
mime = stat.mime,
PostMessageOrigin = "*"
}
else
return error("Unknown request")
end
end
if args.action and handle[args.action] then
return handle[args.action](args.args)
else
return error("Invalid action parameter")
end

View File

@ -0,0 +1,8 @@
afx-app-window[data-id="LibreOffice"] div[data-id="editor-area"] p{
text-align: center;
}
afx-app-window[data-id="LibreOffice"] div[data-id="editor-area"] button {
width: 250px;
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,26 @@
{
"pkgname": "LibreOffice",
"app":"LibreOffice",
"name":"Libre Office Online",
"description":"Wrapper for Libre Office Online service",
"info":{
"author": "Dany LE",
"email": "contact@iohub.dev"
},
"version":"0.1.0-a",
"category":"Office",
"iconclass":"bi bi-person-workspace",
"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"
],
"dependencies":[],
"locale": {}
}

View File

@ -0,0 +1,19 @@
<afx-app-window apptitle="Libre Office Online" width="700" height="500" data-id="LibreOffice" blur-overlay="true">
<afx-hbox >
<div data-id="editor-area">
<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.

Binary file not shown.