Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mastofe
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KokaKiwi
mastofe
Commits
8fe12ac0
Verified
Commit
8fe12ac0
authored
7 years ago
by
Morgan Bazalgette
Committed by
Haelwenn
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix the homepage being loaded issue
parent
c8fe7440
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/javascript/mastodon/service_worker/entry.js
+6
-6
6 additions, 6 deletions
app/javascript/mastodon/service_worker/entry.js
with
6 additions
and
6 deletions
app/javascript/mastodon/service_worker/entry.js
+
6
−
6
View file @
8fe12ac0
...
...
@@ -10,7 +10,7 @@ function openWebCache() {
}
function
fetchRoot
()
{
return
fetch
(
'
/
'
,
{
credentials
:
'
include
'
,
redirect
:
'
manual
'
});
return
fetch
(
'
/
web
'
,
{
credentials
:
'
include
'
,
redirect
:
'
manual
'
});
}
// const firefox = navigator.userAgent.match(/Firefox\/(\d+)/);
...
...
@@ -19,7 +19,7 @@ function fetchRoot() {
// Cause a new version of a registered Service Worker to replace an existing one
// that is already installed, and replace the currently active worker on open pages.
self
.
addEventListener
(
'
install
'
,
function
(
event
)
{
event
.
waitUntil
(
Promise
.
all
([
openWebCache
(),
fetchRoot
()]).
then
(([
cache
,
root
])
=>
cache
.
put
(
'
/
'
,
root
)));
event
.
waitUntil
(
Promise
.
all
([
openWebCache
(),
fetchRoot
()]).
then
(([
cache
,
root
])
=>
cache
.
put
(
'
/
web
'
,
root
)));
});
self
.
addEventListener
(
'
activate
'
,
function
(
event
)
{
event
.
waitUntil
(
self
.
clients
.
claim
());
...
...
@@ -27,17 +27,17 @@ self.addEventListener('activate', function(event) {
self
.
addEventListener
(
'
fetch
'
,
function
(
event
)
{
const
url
=
new
URL
(
event
.
request
.
url
);
if
(
url
.
pathname
.
startsWith
(
'
/web
/
'
))
{
if
(
url
.
pathname
.
startsWith
(
'
/web
'
))
{
const
asyncResponse
=
fetchRoot
();
const
asyncCache
=
openWebCache
();
event
.
respondWith
(
asyncResponse
.
then
(
response
=>
{
const
clonedResponse
=
response
.
clone
();
asyncCache
.
then
(
cache
=>
cache
.
put
(
'
/
'
,
clonedResponse
)).
catch
();
asyncCache
.
then
(
cache
=>
cache
.
put
(
'
/
web
'
,
clonedResponse
)).
catch
();
return
response
;
},
()
=>
asyncCache
.
then
(
cache
=>
cache
.
match
(
'
/
'
))));
()
=>
asyncCache
.
then
(
cache
=>
cache
.
match
(
'
/
web
'
))));
}
else
if
(
url
.
pathname
===
'
/auth/sign_out
'
)
{
const
asyncResponse
=
fetch
(
event
.
request
);
const
asyncCache
=
openWebCache
();
...
...
@@ -45,7 +45,7 @@ self.addEventListener('fetch', function(event) {
event
.
respondWith
(
asyncResponse
.
then
(
response
=>
{
if
(
response
.
ok
||
response
.
type
===
'
opaqueredirect
'
)
{
return
Promise
.
all
([
asyncCache
.
then
(
cache
=>
cache
.
delete
(
'
/
'
)),
asyncCache
.
then
(
cache
=>
cache
.
delete
(
'
/
web
'
)),
indexedDB
.
deleteDatabase
(
'
mastodon
'
),
]).
then
(()
=>
response
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment