Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add PWA caching and cache updater #1421

Merged
merged 8 commits into from
Jun 19, 2023

Conversation

meteyou
Copy link
Member

@meteyou meteyou commented Jun 18, 2023

Description

This PR add PWA workbox to cache all assets to run Mainsail offline and add a updater function/dialog.

Related Tickets & Documents

no related tickes

Mobile & Desktop Screenshots/Recordings

image

[optional] Are there any post-deployment tasks we need to perform?

meteyou added 5 commits June 18, 2023 15:06
Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
@meteyou meteyou requested review from pataar and dw-0 June 18, 2023 13:12
@meteyou
Copy link
Member Author

meteyou commented Jun 18, 2023

@QuinnDamerell if you want to double-check the cache function. This is the PR for it.

@github-actions
Copy link
Contributor

Language file analysis report:

File Missing Keys Unused Keys
de.json 17 1
en.json 0 1

src/locales/de.json Outdated Show resolved Hide resolved
Co-authored-by: th33xitus <domwil1091+github@gmail.com>
@github-actions
Copy link
Contributor

Language file analysis report:

File Missing Keys Unused Keys
de.json 17 1
en.json 0 1

@QuinnDamerell
Copy link
Contributor

Amazing! Nice work!

@pataar
Copy link
Member

pataar commented Jun 19, 2023

AFAIK a PWA doesn't work on a non-https based application. Aside from that, it looks good to me!

@meteyou
Copy link
Member Author

meteyou commented Jun 19, 2023

AFAIK a PWA doesn't work on a non-https based application. Aside from that, it looks good to me!

I tested it with a reverse proxy to get a valid lets encrypted certificate. I also see very little use for single setups. This feature is more useful for octoprinteverywhere integration or similar use cases.

Thx for your review!

@pataar
Copy link
Member

pataar commented Jun 19, 2023

AFAIK a PWA doesn't work on a non-https based application. Aside from that, it looks good to me!

I tested it with a reverse proxy to get a valid lets encrypted certificate. I also see very little use for single setups. This feature is more useful for octoprinteverywhere integration or similar use cases.

Thx for your review!

With pleasure!

@QuinnDamerell
Copy link
Contributor

I didn’t think about this only working on https sites. That’s probably why more users didn’t hit this before now. But as you pointed out, for sites that reverse proxy Mainsail like mine, (https://octoeverywhere.com) having the local cache is so nice!

@meteyou you’re welcome to use my service for testing if it helps you at all. It’s free and provides unlimited data, so it might be helpful to you. On top of that, I’m more than happy to add any features you need that would help you to test!

It’s really a shame it’s not easier to generate per-user certs for .local domains. In modern times it would be nice to even have encryption on your LAN.

@meteyou
Copy link
Member Author

meteyou commented Jun 19, 2023

Thx! I will test it with octoeverywhere (i have it also installed on my small V2). I used this guide for installing it: https://notthebe.ee/blog/easy-ssl-in-homelab-dns01/

The browser also blocked self-signed certs for PWA... So I think it's close to impossible for not linux experienced users to install a certificate for the printer him/her self...

@QuinnDamerell
Copy link
Contributor

Nice! Yeah, I think the concept of SSL certs breaks down for .local domains, because half of an SSL cert asserts ownership over a unique domain. But many users could have klipper.local at home or something. I think supporting the .local domains, there would have to be some kind of special standard made. Even the "easy to set up" article you linked to has like 20 steps, so yeah,I don't think many users are going to figure that out. :D

meteyou added 2 commits June 19, 2023 19:50
Signed-off-by: Stefan Dej <meteyou@gmail.com>
Signed-off-by: Stefan Dej <meteyou@gmail.com>
@github-actions
Copy link
Contributor

Language file analysis report:

File Missing Keys Unused Keys
de.json 17 1
en.json 0 1
zh.json 32 1

@meteyou meteyou merged commit 8fc2750 into mainsail-crew:develop Jun 19, 2023
@meteyou meteyou deleted the feat/add-pwa-caching branch June 19, 2023 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants