Commit 06a9a6c4 authored by Philip Müller's avatar Philip Müller
Browse files

Merge branch 'master' into 'master'

v2 initial commit

See merge request !12
parents a28c8136 f03946d2
PREFIX ?= /usr/local
BUILDDIR = build
ICONDIR = $(PREFIX)/share/pixmaps
APPS = office word excel onenote outlook powerpoint skype
APPS2 = office2 word2 excel2 onenote2 outlook2 powerpoint2 skype2
OFFICEDOMAINS = \"https://office.live.com\", \"https://www.office.com\"
CATEGORY ?= Office
all: build
$(APPS):
mkdir -p $(BUILDDIR)/$@
sed "s|@APPNAME@|\u$@|; \
s|@APPNAMELOWER@|\L$@|; \
s|@CATEGORY@|$(CATEGORY)|" launcher.desktop.in > $(BUILDDIR)/$@/$@.desktop
sed "s|@ICON@|$(ICONDIR)/ms-$@.png|; \
s|@URL@|$(URL)|; \
s|@DOMAINS@|$(DOMAINS)|; \
s|@UA@|$(UA)|" settings.json.in > $(BUILDDIR)/$@/settings.json
sed "s|@PREFIX@|$(PREFIX)|; \
s|@APPNAMELOWER@|\L$@|" launcher.sh.in > $(BUILDDIR)/$@/ms-$@
office2: URL = https://www.office.com/login?es=Click\&ru=%2F
office2: DOMAINS = $(OFFICEDOMAINS)
office2: office
word2: URL = https://office.live.com/start/Word.aspx
word2: DOMAINS = $(OFFICEDOMAINS)
word2: word
excel2: URL = https://office.live.com/start/Excel.aspx
excel2: DOMAINS = $(OFFICEDOMAINS)
excel2: excel
onenote2: URL = https://www.onenote.com/notebooks
onenote2: onenote
outlook2: URL = https://outlook.live.com/owa
outlook2: DOMAINS = \"https://people.live.com\", \"https://calendar.live.com\"
outlook2: UA = Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/602.2.14 (KHTML, like Gecko) Version/10.0.1 Safari/602.2.14
outlook2: outlook
powerpoint2: URL = https://office.live.com/start/PowerPoint.aspx
powerpoint2: DOMAINS = $(OFFICEDOMAINS)
powerpoint2: powerpoint
skype2: URL = https://web.skype.com
skype2: CATEGORY = Network
skype2: skype
build: $(APPS2)
sed "s|@PREFIX@|$(PREFIX)|" ms-office-online.in > $(BUILDDIR)/ms-office-online
install: build
for app in $(APPS); do \
install -Dm644 icons/$$app.png \
$(DESTDIR)$(ICONDIR)/ms-$$app.png ; \
install -Dm755 $(BUILDDIR)/ms-office-online \
$(DESTDIR)$(PREFIX)/share/ms-office-online/$$app/ms-$$app-online ; \
install -Dm755 $(BUILDDIR)/$$app/ms-$$app \
$(DESTDIR)$(PREFIX)/bin/ms-$$app ; \
install -Dm644 $(BUILDDIR)/$$app/settings.json \
$(DESTDIR)$(PREFIX)/share/ms-office-online/$$app/settings.json ; \
install -Dm644 $(BUILDDIR)/$$app/$$app.desktop \
$(DESTDIR)$(PREFIX)/share/applications/ms-$$app.desktop ; \
done
clean:
rm -fr $(BUILDDIR)
.PHONY: build install clean $(APPS) $(APPS2)
......@@ -13,7 +13,7 @@ This launcher uses JAK to display Microsoft Office Suite Online as native applic
### Dependencies
* Jade Application Kit >= 0.36
* Jade Application Kit >= 2.0.0
### Building
......
[Desktop Entry]
Version=1.0
Terminal=false
Icon=ms-@APPNAMELOWER@
Icon=ms-office
Type=Application
Categories=@CATEGORY@;
Exec=ms-@APPNAMELOWER@
Name=Microsoft @APPNAME@ Online
GenericName=@APPNAME@
Comment=Use the online version of Microsoft @APPNAME@
Categories=Office
Exec=ms-office-online
Name=Microsoft Office Online
GenericName=Microsoft Office Online
Comment=Use the online version of Microsoft Office
Keywords=office;web;internet
StartupNotify=true
#!/bin/sh
cd @PREFIX@/share/ms-office-online/@APPNAMELOWER@
./ms-@APPNAMELOWER@-online
#!/usr/bin/env python
try:
# Testing locally
from Application import JWebApp
except ImportError:
# Production
from JAK.Application import JWebApp
def app():
start = "https://office.live.com"
icon = "/usr/share/pixmaps/ms-office.png"
adverts = "tpc.googlesyndication.com", "googleads.g.doubleclick.net", "tag.sp.advertising.com",\
"banner.advertising.com", "cdn.bannerflow.com", "acdn.adnxs.com"
tab_only_allow = "office.live.com", "www.office.com", "forms.office.", "people.live.com", "onedrive.",\
"d.docs.live.", "www.onenote.", "outlook.", "www.outlook.", "sway.office.com", "1drv.ms/", \
"to-do.microsoft.com/", "word-edit.officeapps.live", "calendar.live.", "login.live.com",\
"login.microsoftonline.com/", "onenote"
css_hide = ".hero-section, .tiles-section, a[href*='skype'], a[href*='bing'], a[href*='msn'], \
a[href*='https://g.live.com'], ._14PqNbws6gkP3kvU8nzH0G {display:none !important;}"
deny = "account", "support", "web.skype", "www.microsoft", "store.office.com", "msn.com", "bing.",\
"products.office", "go.microsoft.com", "privacy."
rules = {"WebBrowserTab": tab_only_allow, "WebBrowserWindow": deny, "block": adverts}
""" Icons need to be in a subfolder of the application
toolbar = ({"name": "Office", "url": "https://office.live.com", "icon": "icon/ms-office.png"},
{"name": "Excel", "url": "https://office.live.com/start/Excel.aspx?", "icon": "icon/ms-excel.png"},
{"name": "Word", "url": "https://office.live.com/start/Word.aspx?", "icon": "icon/ms-word.png"},
{"name": "PowerPoint", "url": "https://office.live.com/start/PowerPoint.aspx?", "icon": "icon/ms-powerpoint.png"},
{"name": "OutLook", "url": "https://outlook.com", "icon": "icon/ms-outlook.png"},
{"name": "OneNote", "url": "https://www.onenote.com", "icon": "icon/ms-onenote.png"})
"""
webapp = JWebApp(title="Microsoft Office Online", icon=icon, web_contents=start, online=True,
cookies_path="microsoft", url_rules=rules, custom_css=css_hide)
return webapp
app().run()
#!/usr/bin/env python3
# coding: utf-8
import os
from j.AK import Api, AppWindow, settings
from gi.repository import Gtk, WebKit2, GLib
def same_frame():
# open url in same window
return tuple(settings("webkit", "same_frame"))
class OfficeWindow(AppWindow):
"""
extends AK.AppWindow functionality
"""
def __init__(self):
super(OfficeWindow, 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 separate window.
"""
def default_settings():
# use default settings file
os.chdir("@PREFIX@/share/ms-office-online/office/")
def launch(url):
GLib.spawn_command_line_async("jak " + url)
if decision_type == WebKit2.PolicyDecisionType.NEW_WINDOW_ACTION:
url = decision.get_navigation_action().get_request().get_uri()
if url.startswith(same_frame()):
self.webview.load_uri(url)
else:
if url.startswith(("https://people", "https://outlook", "https://calendar")):
os.chdir("@PREFIX@/share/ms-office-online/outlook/")
elif url.startswith("https://www.onenote"):
os.chdir("@PREFIX@/share/ms-office-online/onenote/")
elif url.startswith("https://web.skype"):
os.chdir("@PREFIX@/share/ms-office-online/skype/")
else:
default_settings()
launch(url)
elif decision_type == WebKit2.PolicyDecisionType.NAVIGATION_ACTION:
url = decision.get_navigation_action().get_request().get_uri()
if url.startswith("https://account"):
default_settings()
launch(url)
decision.ignore()
return True
self.webview.load_uri(settings("app", "route"))
self.webview.connect("decide-policy", on_decide_policy)
OfficeWindow()
Gtk.main()
{
"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": "@ICON@"
},
"webkit": {
"cache": "online",
"context_menu": false,
"user_agent": "@UA@",
"site_quirks": true,
"same_frame": [@DOMAINS@]
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment