Skip to content

Commit c8dbab2

Browse files
committed
Prepared for publishing to GitHub Pages and changed SW absolute paths into relative ones.
1 parent 84da084 commit c8dbab2

5 files changed

Lines changed: 66 additions & 20 deletions

File tree

.github/workflows/static.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["main"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v5
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
# Upload entire repository
40+
path: '.'
41+
- name: Deploy to GitHub Pages
42+
id: deployment
43+
uses: actions/deploy-pages@v4

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
# Motor Control Client
22

3-
This client is to be used with the [MotorControlServer](https://github.com/kottochii/MotorControlServer). It allows the user to sign in by pin to a running server.
3+
This client is to be used with the [MotorControlServer](https://github.com/kottochii/MotorControlServer). It allows the user to sign in by pin to a running server.
44

55
## PWA
66
This is a PWA-ready app, which means that when root is run on the server that meets [minimum requirements](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable#https_localhost_or_loopback_are_required), the user will be able to install the app in their browser.
77

8+
### GitHub Pages
9+
This repository is published to https://kottochii.github.io/MotorControlClient/
10+
811
## Setup (input the server data)
912
When the app is opened the first time, it cannot function without a setup process. This involves:
10-
1. going to settings by clicking a respective icon in top-right corner.
13+
1. Going to settings by clicking a respective icon in top-right corner.
1114
2. Adding hostname with port (e.g. `localhost:5555`) of the server on the first line
1215
3. Selecting a radio `HTTP` or `HTTPS`
1316
4. Setting `App ID` and `App Hash` as per database.

app_offline_sw.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11

22
const CACHE_VERSION = 'motor-control-client-v1';
33
const URLS_TO_CACHE = [
4-
'/',
5-
'/css/main.css',
6-
'/img/motor_icon_192.png',
7-
'/img/motor_icon_512.png',
8-
'/img/settings_icon.svg',
9-
'/js/api_logic.js',
10-
'/js/jquery-3.7.1.min.js',
11-
'/js/keypad_logic.js',
12-
'/js/settings.js',
13-
'/js/signed_in_worker.js',
14-
'/js/signin_state.js',
15-
'/js/state_manager.js',
16-
'/app_offline_sw.js',
17-
'/index.html',
18-
'/manifest.webmanifest'
4+
'./',
5+
'./css/main.css',
6+
'./img/motor_icon_192.png',
7+
'./img/motor_icon_512.png',
8+
'./img/settings_icon.svg',
9+
'./js/api_logic.js',
10+
'./js/jquery-3.7.1.min.js',
11+
'./js/keypad_logic.js',
12+
'./js/settings.js',
13+
'./js/signed_in_worker.js',
14+
'./js/signin_state.js',
15+
'./js/state_manager.js',
16+
'./app_offline_sw.js',
17+
'./index.html',
18+
'./manifest.webmanifest'
1919
];
2020

2121
self.addEventListener('install', event => {

js/settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
if ('serviceWorker' in navigator) {
22
window.addEventListener('load', () => {
3-
navigator.serviceWorker.register('/app_offline_sw.js')
3+
navigator.serviceWorker.register('./app_offline_sw.js')
44
.then(registration => console.log('SW registered', registration))
55
.catch(err => console.log('SW registration failed: ', err));
66
});

manifest.webmanifest

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"short_name": "Motor Controller",
33
"name": "Motor Controller Client",
4-
"start_url": "/",
5-
"scope": "/",
4+
"start_url": "./",
5+
"scope": "./",
66
"display": "standalone",
77
"theme_color": "#000000",
88
"background_color": "#ffffff",

0 commit comments

Comments
 (0)