remove service worker bc skill issue

This commit is contained in:
Ayaka
2022-10-13 11:24:48 +00:00
parent 583aa5c54e
commit 2580c87e64
8 changed files with 44 additions and 47 deletions

View File

@@ -21,9 +21,6 @@
<meta property="og:image" content="/og-image.png" /> <meta property="og:image" content="/og-image.png" />
<meta property="og:url" content="https://st.ayaka.one" /> <meta property="og:url" content="https://st.ayaka.one" />
<meta property="og:site_name" content="Project Sekai Stickers" /> <meta property="og:site_name" content="Project Sekai Stickers" />
<script>
navigator.serviceWorker.register("sw.js");
</script>
<meta property="og:type" content="website" /> <meta property="og:type" content="website" />
</head> </head>
<body> <body>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +0,0 @@
import { precacheAndRoute } from 'workbox-precaching/precacheAndRoute';
precacheAndRoute([{"revision":"5013924527096909c88d2bba3a04cb03","url":"App.css"},{"revision":"363cf5ef8045b76ae3fa53f6f630980f","url":"index.css"}]);

View File

@@ -11,6 +11,17 @@ import Picker from "./components/Picker";
const { ClipboardItem } = window; const { ClipboardItem } = window;
function App() { function App() {
// unregister service worker because skill issue
useEffect(() => {
if ("serviceWorker" in navigator) {
navigator.serviceWorker.getRegistrations().then(function (registrations) {
for (let registration of registrations) {
registration.unregister();
}
});
}
}, []);
const [character, setCharacter] = useState(49); const [character, setCharacter] = useState(49);
const [text, setText] = useState(characters[character].defaultText.text); const [text, setText] = useState(characters[character].defaultText.text);
const [position, setPosition] = useState({ const [position, setPosition] = useState({
@@ -48,13 +59,23 @@ function App() {
ctx.canvas.height = 256; ctx.canvas.height = 256;
if (loaded && document.fonts.check("12px YurukaStd")) { if (loaded && document.fonts.check("12px YurukaStd")) {
var hRatio = ctx.canvas.width / img.width ; var hRatio = ctx.canvas.width / img.width;
var vRatio = ctx.canvas.height / img.height ; var vRatio = ctx.canvas.height / img.height;
var ratio = Math.min ( hRatio, vRatio ); var ratio = Math.min(hRatio, vRatio);
var centerShift_x = ( ctx.canvas.width - img.width*ratio ) / 2; var centerShift_x = (ctx.canvas.width - img.width * ratio) / 2;
var centerShift_y = ( ctx.canvas.height - img.height*ratio ) / 2; var centerShift_y = (ctx.canvas.height - img.height * ratio) / 2;
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height); ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.drawImage(img, 0,0, img.width, img.height,centerShift_x,centerShift_y,img.width*ratio, img.height*ratio); ctx.drawImage(
img,
0,
0,
img.width,
img.height,
centerShift_x,
centerShift_y,
img.width * ratio,
img.height * ratio
);
ctx.font = `${fontSize}px YurukaStd`; ctx.font = `${fontSize}px YurukaStd`;
ctx.lineWidth = 9; ctx.lineWidth = 9;
ctx.save(); ctx.save();
@@ -64,25 +85,25 @@ ctx.drawImage(img, 0,0, img.width, img.height,centerShift_x,centerShift_y,img.wi
ctx.textAlign = "center"; ctx.textAlign = "center";
ctx.strokeStyle = "white"; ctx.strokeStyle = "white";
ctx.fillStyle = characters[character].color; ctx.fillStyle = characters[character].color;
var lines = text.split('\n'); var lines = text.split("\n");
if (curve) { if (curve) {
for (let line of lines){ for (let line of lines) {
for (let i = 0; i < line.length; i++) { for (let i = 0; i < line.length; i++) {
ctx.rotate(angle / line.length / 2.5); ctx.rotate(angle / line.length / 2.5);
ctx.save(); ctx.save();
ctx.translate(0, -1 * fontSize * 3.5); ctx.translate(0, -1 * fontSize * 3.5);
ctx.strokeText(line[i], 0, 0); ctx.strokeText(line[i], 0, 0);
ctx.fillText(line[i], 0, 0); ctx.fillText(line[i], 0, 0);
ctx.restore(); ctx.restore();
}
} }
}
} else { } else {
for (var i = 0,k=0; i<lines.length; i++){ for (var i = 0, k = 0; i < lines.length; i++) {
ctx.strokeText(lines[i], 0, k); ctx.strokeText(lines[i], 0, k);
ctx.fillText(lines[i],0, k ) ctx.fillText(lines[i], 0, k);
k+=spaceSize k += spaceSize;
} }
ctx.restore(); ctx.restore();
} }
} }
}; };

View File

@@ -1,11 +0,0 @@
module.exports = {
globDirectory: 'public/',
globPatterns: [
'**/*.{png,xml,ico,html,svg,jpg,webmanifest}'
],
swDest: 'public/sw.js',
ignoreURLParametersMatching: [
/^utm_/,
/^fbclid$/
]
};