aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Reeder2021-08-02 18:34:21 -0600
committerColin Reeder2021-08-02 18:34:31 -0600
commite6471f3af5b9d008e2327995a92cc56402bc8baa (patch)
treebcbed35436c670751cfc684151f65af7d0ee930c
downloadaur-e6471f3af5b9d008e2327995a92cc56402bc8baa.tar.gz
squashed
-rw-r--r--.SRCINFO25
-rw-r--r--.gitignore4
-rw-r--r--PKGBUILD42
-rw-r--r--README.md8
-rw-r--r--appconfig.prod.json4
-rw-r--r--hide-scrollbar.patch11
-rw-r--r--index.js17
-rw-r--r--lichesslogowhite.svg56
-rw-r--r--lichobile-electron.desktop9
-rwxr-xr-xrun.sh9
10 files changed, 185 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..ec9fdc72bfd8
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,25 @@
+pkgbase = lichobile-electron
+ pkgdesc = lichess.org mobile application, packaged with electron
+ pkgver = 7.11.3
+ pkgrel = 3
+ url = https://lichess.org/mobile
+ arch = any
+ license = GPL-3.0-or-later
+ makedepends = npm
+ depends = electron
+ source = https://github.com/veloce/lichobile/archive/refs/tags/v7.11.3.tar.gz
+ source = appconfig.prod.json
+ source = run.sh
+ source = lichobile-electron.desktop
+ source = lichesslogowhite.svg
+ source = hide-scrollbar.patch
+ source = index.js
+ sha256sums = 27719c7be577931e8b2020d6e27760a00982b55efd1d6a507128e0f2168224a6
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+
+pkgname = lichobile-electron
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..9267f0a6a7fa
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+*.pkg.*
+*.tar.gz
+/pkg
+/src
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..264c5cd823cb
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,42 @@
+_pkgname=lichobile
+pkgname="$_pkgname-electron"
+pkgver=7.11.3
+pkgrel=3
+pkgdesc="lichess.org mobile application, packaged with electron"
+arch=(any)
+url="https://lichess.org/mobile"
+license=("GPL-3.0-or-later")
+depends=(electron)
+makedepends=(npm)
+source=("https://github.com/veloce/lichobile/archive/refs/tags/v$pkgver.tar.gz" "appconfig.prod.json" "run.sh" "lichobile-electron.desktop" "lichesslogowhite.svg" "hide-scrollbar.patch" "index.js")
+sha256sums=("27719c7be577931e8b2020d6e27760a00982b55efd1d6a507128e0f2168224a6" "SKIP" "SKIP" "SKIP" "SKIP" "SKIP" "SKIP")
+
+prepare() {
+ cd "$_pkgname-$pkgver"
+ npm install
+
+ cp ../appconfig.prod.json ./
+
+ patch -Np1 -i ../hide-scrollbar.patch
+}
+
+build() {
+ cd "$_pkgname-$pkgver"
+ APP_MODE=release APP_CONFIG=prod npm run build
+}
+
+package() {
+ cd "$_pkgname-$pkgver"
+
+ install -d "$pkgdir"/usr/share/webapps/$_pkgname
+
+ cp -r www/* "$pkgdir"/usr/share/webapps/$_pkgname
+
+ install -Dm755 ../run.sh "$pkgdir"/usr/bin/$pkgname
+
+ install -Dm644 -t "$pkgdir"/usr/share/applications ../lichobile-electron.desktop
+ install -Dm644 -t "$pkgdir"/usr/share/icons/hicolor/scalable/apps ../lichesslogowhite.svg
+
+ install -Dm644 -t "$pkgdir"/usr/lib/$pkgname ../index.js
+ ln -s /usr/share/webapps/$_pkgname "$pkgdir"/usr/lib/$pkgname/www
+}
diff --git a/README.md b/README.md
new file mode 100644
index 000000000000..8d27da60637b
--- /dev/null
+++ b/README.md
@@ -0,0 +1,8 @@
+# lichobile-electron
+
+A set of files to allow the lichess mobile app to run on linux mobile platforms using electron.
+
+Currently an Arch package is provided, but it should be possible to do something similar for other distros.
+
+## Known Issues
+- Local Stockfish doesn't work
diff --git a/appconfig.prod.json b/appconfig.prod.json
new file mode 100644
index 000000000000..401dbaa14c5e
--- /dev/null
+++ b/appconfig.prod.json
@@ -0,0 +1,4 @@
+{
+ "apiEndPoint": "https://lichess.org",
+ "socketEndPoint": "wss://socket.lichess.org"
+}
diff --git a/hide-scrollbar.patch b/hide-scrollbar.patch
new file mode 100644
index 000000000000..414eb69358e8
--- /dev/null
+++ b/hide-scrollbar.patch
@@ -0,0 +1,11 @@
+diff --git a/src/styl/main.styl b/src/styl/main.styl
+index be95a73bf..45208f4e5 100644
+--- a/src/styl/main.styl
++++ b/src/styl/main.styl
+@@ -287,3 +287,6 @@ main
+ margin-bottom: env(safe-area-inset-bottom);
+ @media only screen and (orientation portrait) and (min-width 768px) and (min-height 768px)
+ flex 0 0 footerHeightBigScreens
++
++*::-webkit-scrollbar
++ display none
diff --git a/index.js b/index.js
new file mode 100644
index 000000000000..fb2b3672d4d7
--- /dev/null
+++ b/index.js
@@ -0,0 +1,17 @@
+const { app, BrowserWindow } = require("electron");
+
+app.whenReady().then(() => {
+ const mainWindow = new BrowserWindow({autoHideMenuBar: true, backgroundColor: "#161512"});
+ mainWindow.loadFile("www/index.html");
+ mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
+ {urls: ["wss://socket.lichess.org/*"]},
+ (details, callback) => {
+ delete details.requestHeaders.Origin;
+ callback({requestHeaders: details.requestHeaders});
+ },
+ );
+});
+
+app.on("window-all-closed", () => {
+ app.quit();
+});
diff --git a/lichesslogowhite.svg b/lichesslogowhite.svg
new file mode 100644
index 000000000000..feee9b4e1076
--- /dev/null
+++ b/lichesslogowhite.svg
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ viewBox="0 0 50 50"
+ version="1.1"
+ id="svg4"
+ sodipodi:docname="lichesslogo_white.svg"
+ inkscape:version="0.92.3 (2405546, 2018-03-11)">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="738"
+ inkscape:window-height="480"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="4.72"
+ inkscape:cx="25"
+ inkscape:cy="25"
+ inkscape:window-x="253"
+ inkscape:window-y="197"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg4" />
+ <path
+ fill="#000000"
+ stroke="#000000"
+ stroke-linejoin="round"
+ d="M38.956.5c-3.53.418-6.452.902-9.286 2.984C5.534 1.786-.692 18.533.68 29.364 3.493 50.214 31.918 55.785 41.329 41.7c-7.444 7.696-19.276 8.752-28.323 3.084C3.959 39.116-.506 27.392 4.683 17.567 9.873 7.742 18.996 4.535 29.03 6.405c2.43-1.418 5.225-3.22 7.655-3.187l-1.694 4.86 12.752 21.37c-.439 5.654-5.459 6.112-5.459 6.112-.574-1.47-1.634-2.942-4.842-6.036-3.207-3.094-17.465-10.177-15.788-16.207-2.001 6.967 10.311 14.152 14.04 17.663 3.73 3.51 5.426 6.04 5.795 6.756 0 0 9.392-2.504 7.838-8.927L37.4 7.171z"
+ id="path2"
+ style="fill:#ffffff;stroke:#ffffff;stroke-opacity:0.99607843" />
+</svg>
diff --git a/lichobile-electron.desktop b/lichobile-electron.desktop
new file mode 100644
index 000000000000..391744e16e9f
--- /dev/null
+++ b/lichobile-electron.desktop
@@ -0,0 +1,9 @@
+[Desktop Entry]
+Name=lichess
+Comment=lichess.org mobile application, packaged with electron
+Exec=/usr/bin/lichobile-electron %u
+Icon=lichesslogowhite
+Terminal=false
+Type=Application
+Categories=Game;StrategyGame;
+X-Purism-FormFactor=Workstation;Mobile;
diff --git a/run.sh b/run.sh
new file mode 100755
index 000000000000..376104bfee12
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+params=""
+
+if [ -n "$WAYLAND_DISPLAY" ]; then
+ params="--enable-features=UseOzonePlatform --ozone-platform=wayland"
+fi
+
+electron $params /usr/lib/lichobile-electron