Skip to content
This repository has been archived by the owner on Sep 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #477 from codesardine/master
Browse files Browse the repository at this point in the history
update MS-Office online
  • Loading branch information
philmmanjaro committed Apr 18, 2018
2 parents ceb107f + b4f0a76 commit f398db0
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 68 deletions.
60 changes: 30 additions & 30 deletions ms-office-online/PKGBUILD
Expand Up @@ -5,7 +5,7 @@ pkgver=18.04.0
pkgrel=1
pkgdesc="Microsoft Office Suite Online for Manjaro Linux"
url="https://www.office.com/"
depends=('python-jade-application-kit>=0.a35')
depends=('python-jade-application-kit>=0.36')
license=('custom')
arch=('any')
provides=('microsoft-office-online' 'microsoft-office')
Expand All @@ -23,9 +23,9 @@ source=('ms-office-online'
'Word.desktop'
'Outlook.desktop'
'OneNote.desktop'
'WebSkype.desktop'
'application-settings.json')
sha256sums=('e2cdbcd8a824975008f7fff42679403b3d61d2eb78c585364ce177fcc6dc6295'
'settings.json'
'WebSkype.desktop')
sha256sums=('675608ff3510a5b3ae840fe0b680c77a1ef7cecdb33ba6e2c914d844f02d7bba'
'4b56e30b503bf76dd2887677d0ddf892d928655b968ce484253c879525805e3b'
'ef09c317a685559698a8da72bd455f55a4db7e8a62b3fe0a18caedf5ceba9b83'
'f2134e5c8cfd26e0a014d12467d4cb0ee3575f37ffa4ae3fc2422e8ba3093258'
Expand All @@ -39,8 +39,8 @@ sha256sums=('e2cdbcd8a824975008f7fff42679403b3d61d2eb78c585364ce177fcc6dc6295'
'5ae79390d43e82273c5acd76b65bcc610ac37420faae4ce9c8e74d71e1e08355'
'439143c1fa418a2aa460bb2b181b575975dc2eda0acacfd6601bd427a4d0e7fa'
'11c7701466a62cb5369e686a2ba37f63d4c92d073562c26656a4f35046648e29'
'14c8daf3b9e3deb38e56b0cf029466299f1bd9f32082b678358349d7912d0a65'
'deb7bd726ea78db904b7c96327ba679b904ec2f0cb14da9b0bdb72cc2378e83f')
'22ff1d1cb0c8f614082e56857d55ebcdd4392498464ce9e7bf717ebb42a177ac'
'14c8daf3b9e3deb38e56b0cf029466299f1bd9f32082b678358349d7912d0a65')
package() {
# Install ms-office-online launcher
install -Dm755 "${srcdir}"/ms-office-online "${pkgdir}"/usr/share/ms-office/msoffice/ms-office-online
Expand All @@ -50,64 +50,64 @@ package() {
install -Dm755 "${srcdir}"/ms-office-online "${pkgdir}"/usr/share/ms-office/outlook/ms-office-online
install -Dm755 "${srcdir}"/ms-office-online "${pkgdir}"/usr/share/ms-office/onenote/ms-office-online
install -Dm755 "${srcdir}"/ms-office-online "${pkgdir}"/usr/share/ms-office/webskype/ms-office-online


# Install json settings
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/msoffice/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/powerpoint/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/excel/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/word/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/outlook/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/onenote/settings.json
install -Dm644 "${srcdir}"/settings.json "${pkgdir}"/usr/share/ms-office/webskype/settings.json

# Create binaries
mkdir -p "${pkgdir}"/usr/bin

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/msoffice
echo "cd /usr/share/ms-office/msoffice" >> "${pkgdir}"/usr/bin/msoffice
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/msoffice
sed -i -e "s|_URL_|https://www.office.com/login?es=Click&ru=%2F|" "${pkgdir}"/usr/share/ms-office/msoffice/ms-office-online
sed -i -e "s|_URL_|https://www.office.com/login?es=Click&ru=%2F|" "${pkgdir}"/usr/share/ms-office/msoffice/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/powerpoint
echo "cd /usr/share/ms-office/powerpoint" >> "${pkgdir}"/usr/bin/powerpoint
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/powerpoint
sed -i -e "s|_URL_|https://office.live.com/start/PowerPoint.aspx|" "${pkgdir}"/usr/share/ms-office/powerpoint/ms-office-online
sed -i -e "s|_URL_|https://office.live.com/start/PowerPoint.aspx|" "${pkgdir}"/usr/share/ms-office/powerpoint/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/excel
echo "cd /usr/share/ms-office/excel" >> "${pkgdir}"/usr/bin/excel
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/excel
sed -i -e "s|_URL_|https://office.live.com/start/Excel.aspx|" "${pkgdir}"/usr/share/ms-office/excel/ms-office-online
sed -i -e "s|_URL_|https://office.live.com/start/Excel.aspx|" "${pkgdir}"/usr/share/ms-office/excel/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/word
echo "cd /usr/share/ms-office/word" >> "${pkgdir}"/usr/bin/word
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/word
sed -i -e "s|_URL_|https://office.live.com/start/Word.aspx|" "${pkgdir}"/usr/share/ms-office/word/ms-office-online
sed -i -e "s|_URL_|https://office.live.com/start/Word.aspx|" "${pkgdir}"/usr/share/ms-office/word/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/outlook
echo "cd /usr/share/ms-office/outlook" >> "${pkgdir}"/usr/bin/outlook
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/outlook
sed -i -e "s|_URL_|https://outlook.live.com/owa|" "${pkgdir}"/usr/share/ms-office/outlook/ms-office-online
sed -i -e "s|_URL_|https://outlook.live.com/owa|" "${pkgdir}"/usr/share/ms-office/outlook/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/onenote
echo "cd /usr/share/ms-office/onenote" >> "${pkgdir}"/usr/bin/onenote
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/onenote
sed -i -e "s|_URL_|https://www.onenote.com/notebooks|" "${pkgdir}"/usr/share/ms-office/onenote/ms-office-online
sed -i -e "s|_URL_|https://www.onenote.com/notebooks|" "${pkgdir}"/usr/share/ms-office/onenote/settings.json

echo "#!/bin/sh" > "${pkgdir}"/usr/bin/webskype
echo "cd /usr/share/ms-office/webskype" >> "${pkgdir}"/usr/bin/webskype
echo "./ms-office-online" >> "${pkgdir}"/usr/bin/webskype
sed -i -e "s|_URL_|https://web.skype.com|" "${pkgdir}"/usr/share/ms-office/webskype/ms-office-online
sed -i -e "s|_URL_|https://web.skype.com|" "${pkgdir}"/usr/share/ms-office/webskype/settings.json

chmod a+x "${pkgdir}"/usr/bin/*

# Install json settings
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/msoffice/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/powerpoint/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/excel/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/word/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/outlook/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/onenote/application-settings.json
install -Dm644 "${srcdir}"/application-settings.json "${pkgdir}"/usr/share/ms-office/webskype/application-settings.json

# Configure json settings
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Office.png|" "${pkgdir}"/usr/share/ms-office/msoffice/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/PowerPoint.png|" "${pkgdir}"/usr/share/ms-office/powerpoint/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Excel.png|" "${pkgdir}"/usr/share/ms-office/excel/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Word.png|" "${pkgdir}"/usr/share/ms-office/word/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Outlook.png|" "${pkgdir}"/usr/share/ms-office/outlook/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/OneNote.png|" "${pkgdir}"/usr/share/ms-office/onenote/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Skype.png|" "${pkgdir}"/usr/share/ms-office/webskype/application-settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Office.png|" "${pkgdir}"/usr/share/ms-office/msoffice/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/PowerPoint.png|" "${pkgdir}"/usr/share/ms-office/powerpoint/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Excel.png|" "${pkgdir}"/usr/share/ms-office/excel/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Word.png|" "${pkgdir}"/usr/share/ms-office/word/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Outlook.png|" "${pkgdir}"/usr/share/ms-office/outlook/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/OneNote.png|" "${pkgdir}"/usr/share/ms-office/onenote/settings.json
sed -i -e "s|_icon_|/usr/share/icons/ms-office/Skype.png|" "${pkgdir}"/usr/share/ms-office/webskype/settings.json

# Install icons
install -Dm644 "${srcdir}"/Office.png "${pkgdir}"/usr/share/icons/ms-office/Office.png
Expand Down
19 changes: 0 additions & 19 deletions ms-office-online/application-settings.json

This file was deleted.

32 changes: 13 additions & 19 deletions ms-office-online/ms-office-online 100644 → 100755
@@ -1,56 +1,50 @@
#!/usr/bin/env python3
# coding: utf-8
try:
from j.AK import Api, AppWindow
from j.AK import Api, AppWindow, settings

except Exception as err:
print("Ops something went wrong: " + str(err))

import os, subprocess
from gi.repository import Gtk, WebKit2

WEB_APP = "_URL_"

allowedDomains = (WEB_APP, "https://www.onenote.com", "https://outlook.live.com",
"https://office.live.com", "https://www.office.com", "https://office365.com",
"https://r4.res.office365.com", "https://secure.aadcdn.microsoftonline-p.com",
"https://d.docs.live.net", "https://web.skype.com", "https://flow.microsoft.com",
"https://www.sway.com", "https://calendar.live.com", "https://people.live.com")
def same_frame():
# open url in same window
return tuple(settings("webkit", "same_frame"))

class applicationWindow(AppWindow):
"""
extends AK.AppWindow functionality
"""

def __init__(self):

super(applicationWindow, self).__init__()

def on_decide_policy(webview, decision, decision_type):

"""
:param webview:
:param decision:
:param decision_type:
:return: if is not a predicted url open in browser.
:return: if is not a predicted url open in separate window.
"""

def check_Link(url):
print("checking URL - " + url)

if url.startswith(allowedDomains):
print("Domain Allowed - loading - " + url)

if url.startswith(same_frame()):
self.webview.load_uri(url)

else:
print("Not Allowed - Open In Browser - " + url)
GLib.spawn_command_line_async("xdg-open " + url)
# use existing office settings.json
os.chdir("/usr/share/ms-office/msoffice/")
# open url in a new window
subprocess.call(["jak", url])

if decision_type == WebKit2.PolicyDecisionType.NEW_WINDOW_ACTION:
url = decision.get_navigation_action().get_request().get_uri()
check_Link(url)


self.webview.load_uri(WEB_APP)
self.webview.load_uri(settings("app", "route"))
self.webview.connect("decide-policy", on_decide_policy)


Expand Down
19 changes: 19 additions & 0 deletions ms-office-online/settings.json
@@ -0,0 +1,19 @@
{
"app": {
"route": "_URL_",
"name": "Microsoft Office Online",
"description": "Collaborate with others and work together at the same time, with Microsoft Office Online."
},
"window": {
"width": 1150,
"height": 650,
"icon": "/usr/share/icons/ms-office/Office.png"
},
"webkit": {
"cache": "online",
"context_menu": true,
"user_agent": "",
"site_quirks": true,
"same_frame": ["https://www.onenote.com", "https://outlook.live.com", "https://office.live.com", "https://www.office.com"]
}
}

0 comments on commit f398db0

Please sign in to comment.