Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
IcedDog committed Dec 4, 2023
2 parents 2950b46 + cbf079b commit 2e657fe
Show file tree
Hide file tree
Showing 15 changed files with 5,070 additions and 6,554 deletions.
14 changes: 2 additions & 12 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: Build test page to GitHub Pages
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
inputs:
tags:
Expand Down Expand Up @@ -39,11 +37,6 @@ jobs:
- name: Setup Pages
uses: actions/configure-pages@v2

- name: Replace current git hash to HTML
run: |
sed -i 's/{{CURRENT_HASH}}/${{ github.sha }}/g' ./public/index.html
sed -i 's/{{CURRENT_HASH}}/${{ github.sha }}/g' ./public/sw.js
- name: Build webpack
run: |
npm install
Expand All @@ -58,17 +51,14 @@ jobs:
with:
environment: production
version: ${{ github.sha }}
sourcemaps: './dist'
sourcemaps: './dist ./dist/assets'
set_commits: skip
ignore_missing: true

- name: Copy JavaScript to /public
run: cp -rf ./dist/* ./public/

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './public'
path: './dist'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
11 changes: 0 additions & 11 deletions babel.config.js

This file was deleted.

64 changes: 3 additions & 61 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<link rel="shortcut icon" href="./icons/favicon.ico" />
<link rel="manifest" href="./manifest.webmanifest" />
<link href="./style.css" rel="stylesheet" />
<link href="src/style/index.css" rel="stylesheet" />
<!--script src="./eruda.min.js"></script>
<script>eruda.init();</script-->
<script>
const GITHUB_CURRENT_GIT_HASH = `{{CURRENT_HASH}}`;
// 全屏相关。代码来自 lchzh3473
const fullscreen = {
// 切换全屏状态
Expand Down Expand Up @@ -94,26 +92,6 @@
}
};

function setCookie(cname,cvalue,exdays)
{
var d = new Date();
d.setTime(d.getTime()+(exdays*24*60*60*1000));
var expires = "expires="+d.toGMTString();
document.cookie = cname + "=" + cvalue + "; " + expires;
}

function getCookie(cname)
{
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++)
{
var c = ca[i].trim();
if (c.indexOf(name)==0) return c.substring(name.length,c.length);
}
return "";
}

function getSearchString(name)
{
let searchString = window.location.search.substring(1, window.location.search.length);
Expand All @@ -134,21 +112,6 @@
return null;
}

async function unregistServiceWorker()
{
if (navigator.serviceWorker.getRegistrations)
{
let sws = await navigator.serviceWorker.getRegistrations();
if (sws.length > 1)
{
for (const sw of sws)
{
sw.unregister();
}
}
}
}

if (getSearchString('debug') === 'true')
{
let xhr = new XMLHttpRequest();
Expand All @@ -174,29 +137,6 @@
xhr.open('GET', 'https://cdn.bootcdn.net/ajax/libs/vConsole/3.15.0/vconsole.min.js');
xhr.send();
}

// Init service worker
if (GITHUB_CURRENT_GIT_HASH != '{{' + 'CURRENT_HASH' + '}}' && 'serviceWorker' in navigator)
{
/*
if (navigator.userAgent.indexOf('like Mac OS X') > -1)
{
if (getCookie('ios-unregist') != 'true')
{
unregistServiceWorker();
setCookie('ios-unregist', 'true');
}
}
else */
if (getSearchString('unregistServiceWorker') == 'true')
{
unregistServiceWorker();
}
else
{
navigator.serviceWorker.register('./sw.js');
}
}
</script>
</head>
<body>
Expand Down Expand Up @@ -363,5 +303,7 @@
<pre><code class="content">Test Text Not A Real Error</code></pre>
<div>The infomation about this error will upload to <a href="https://sentry.io" target="_blank">Sentry.io</a> for analyze and debug.</div>
</div>

<script type="module" src="/src/index.js"></script>
</body>
</html>
Loading

0 comments on commit 2e657fe

Please sign in to comment.