PWA
This commit is contained in:
parent
fe7f5bb663
commit
3f1373eb7a
2
.github/script.sh
vendored
2
.github/script.sh
vendored
@ -2,4 +2,4 @@ for file in *; do
|
|||||||
[[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null
|
[[ -f "$file" ]] && mv "$file" "${file,,}" 2>/dev/null
|
||||||
done
|
done
|
||||||
python .github/replace.py
|
python .github/replace.py
|
||||||
python .github/add-headers.py
|
# python .github/add-headers.py
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
import { defineConfig } from "vitepress";
|
import { defineConfig } from "vitepress";
|
||||||
|
import { withPwa } from "@vite-pwa/vitepress";
|
||||||
import UnoCSS from "unocss/vite";
|
import UnoCSS from "unocss/vite";
|
||||||
import { presetUno, presetAttributify, presetIcons } from "unocss";
|
import { presetUno, presetAttributify, presetIcons } from "unocss";
|
||||||
|
import { info } from "./constants";
|
||||||
|
import { pwa } from "./pwa";
|
||||||
|
|
||||||
export default defineConfig({
|
export default withPwa(
|
||||||
|
defineConfig({
|
||||||
title: "FMHY",
|
title: "FMHY",
|
||||||
description:
|
description: info.description,
|
||||||
"The Largest Collection Of Free Stuff On The Internet!The Largest Collection Of Free Stuff On The Internet!",
|
|
||||||
titleTemplate: ":title | FreeMediaHeckYeah",
|
titleTemplate: ":title | FreeMediaHeckYeah",
|
||||||
lang: "en-US",
|
lang: "en-US",
|
||||||
lastUpdated: true,
|
lastUpdated: true,
|
||||||
@ -13,10 +16,30 @@ export default defineConfig({
|
|||||||
appearance: "dark",
|
appearance: "dark",
|
||||||
srcExclude: ["README.md", "single-page", "DEVTools.md"],
|
srcExclude: ["README.md", "single-page", "DEVTools.md"],
|
||||||
ignoreDeadLinks: true,
|
ignoreDeadLinks: true,
|
||||||
|
sitemap: {
|
||||||
|
hostname: info.hostname,
|
||||||
|
},
|
||||||
head: [
|
head: [
|
||||||
["meta", { name: "theme-color", content: "#7bc5e4" }],
|
["meta", { name: "theme-color", content: "#7bc5e4" }],
|
||||||
["meta", { name: "og:type", content: "website" }],
|
["meta", { name: "og:type", content: "website" }],
|
||||||
["meta", { name: "og:locale", content: "en" }],
|
["meta", { name: "og:locale", content: "en" }],
|
||||||
|
["meta", { property: "og:type", content: "website" }],
|
||||||
|
["meta", { property: "og:title", content: info.name }],
|
||||||
|
// ["meta", { property: "og:image", content: ogImage }],
|
||||||
|
["meta", { property: "og:description", content: info.description }],
|
||||||
|
// ["meta", { property: "og:url", content: ogUrl }],
|
||||||
|
["link", { rel: "icon", href: "/favicon.ico", sizes: "any" }],
|
||||||
|
["link", { rel: "icon", href: "/logo.svg", type: "image/svg+xml" }],
|
||||||
|
["link", { rel: "apple-touch-icon", href: "/apple-touch-icon.png" }],
|
||||||
|
["meta", { name: "apple-mobile-web-app-status-bar-style", content: "black-translucent" }],
|
||||||
|
["meta", { name: "author", content: "Joaquín Sánchez" }],
|
||||||
|
["meta", { name: "keywords", content: info.keywords.join(" ") }],
|
||||||
|
["meta", { name: "twitter:description", content: info.description }],
|
||||||
|
["meta", { name: "twitter:title", content: info.name }],
|
||||||
|
["meta", { name: "twitter:card", content: "summary_large_image" }],
|
||||||
|
// ["meta", { name: "twitter:image", content: ogImage }],
|
||||||
|
["meta", { name: "twitter:site", content: info.hostname }],
|
||||||
|
// ["meta", { name: "twitter:url", content: ogUrl }],
|
||||||
],
|
],
|
||||||
vite: {
|
vite: {
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -81,5 +104,7 @@ export default defineConfig({
|
|||||||
link: "https://reddit.com/r/FREEMEDIAHECKYEAH",
|
link: "https://reddit.com/r/FREEMEDIAHECKYEAH",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
...pwa,
|
||||||
},
|
},
|
||||||
});
|
}),
|
||||||
|
);
|
||||||
|
7
.vitepress/constants.ts
Normal file
7
.vitepress/constants.ts
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
export const meta = {
|
||||||
|
name: "FreeMediaHeckYeah",
|
||||||
|
description:
|
||||||
|
"The Largest Collection Of Free Stuff On The Internet!The Largest Collection Of Free Stuff On The Internet!",
|
||||||
|
hostname: "https://fmhy.pages.dev",
|
||||||
|
keywords: ["stream", "movies", "gaming", "reading", "anime"],
|
||||||
|
};
|
89
.vitepress/pwa.ts
Normal file
89
.vitepress/pwa.ts
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
import type { PwaOptions } from "@vite-pwa/vitepress";
|
||||||
|
import { info } from "./constants";
|
||||||
|
|
||||||
|
export const pwa = {
|
||||||
|
outDir: ".vitepress/dist",
|
||||||
|
registerType: "autoUpdate",
|
||||||
|
includeManifestIcons: false,
|
||||||
|
manifest: {
|
||||||
|
id: "/",
|
||||||
|
name: info.name,
|
||||||
|
short_name: info.name,
|
||||||
|
description: info.description,
|
||||||
|
theme_color: "#ffffff",
|
||||||
|
start_url: "/",
|
||||||
|
lang: "en-US",
|
||||||
|
dir: "ltr",
|
||||||
|
orientation: "natural",
|
||||||
|
display: "standalone",
|
||||||
|
display_override: ["window-controls-overlay"],
|
||||||
|
categories: info.keywords,
|
||||||
|
icons: [
|
||||||
|
{
|
||||||
|
src: "pwa-64x64.png",
|
||||||
|
sizes: "64x64",
|
||||||
|
type: "image/png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "pwa-192x192.png",
|
||||||
|
sizes: "192x192",
|
||||||
|
type: "image/png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "pwa-512x512.png",
|
||||||
|
sizes: "512x512",
|
||||||
|
type: "image/png",
|
||||||
|
purpose: "any",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
src: "maskable-icon.png",
|
||||||
|
sizes: "512x512",
|
||||||
|
type: "image/png",
|
||||||
|
purpose: "maskable",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
handle_links: "preferred",
|
||||||
|
launch_handler: {
|
||||||
|
client_mode: ["navigate-existing", "auto"],
|
||||||
|
},
|
||||||
|
edge_side_panel: {
|
||||||
|
preferred_width: 480,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
experimental: {
|
||||||
|
includeAllowlist: true,
|
||||||
|
},
|
||||||
|
workbox: {
|
||||||
|
globPatterns: ["**/*.{css,js,html,svg,png,ico,txt,woff2,json}"],
|
||||||
|
runtimeCaching: [
|
||||||
|
{
|
||||||
|
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
|
||||||
|
handler: "CacheFirst",
|
||||||
|
options: {
|
||||||
|
cacheName: "google-fonts-cache",
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 10,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
||||||
|
},
|
||||||
|
cacheableResponse: {
|
||||||
|
statuses: [0, 200],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
|
||||||
|
handler: "CacheFirst",
|
||||||
|
options: {
|
||||||
|
cacheName: "gstatic-fonts-cache",
|
||||||
|
expiration: {
|
||||||
|
maxEntries: 10,
|
||||||
|
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
|
||||||
|
},
|
||||||
|
cacheableResponse: {
|
||||||
|
statuses: [0, 200],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
} satisfies PwaOptions;
|
@ -1,8 +1,12 @@
|
|||||||
import { h } from "vue";
|
import { h } from "vue";
|
||||||
import "uno.css";
|
import {type Theme, inBrowser } from "vitepress";
|
||||||
import type { Theme } from "vitepress";
|
|
||||||
import DefaultTheme from "vitepress/theme";
|
import DefaultTheme from "vitepress/theme";
|
||||||
import "./style.css";
|
import "./style.css";
|
||||||
|
import "uno.css";
|
||||||
|
|
||||||
|
if (inBrowser)
|
||||||
|
import('./pwa')
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
Layout: () => {
|
Layout: () => {
|
||||||
|
3
.vitepress/theme/pwa.ts
Normal file
3
.vitepress/theme/pwa.ts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import { registerSW } from 'virtual:pwa-register'
|
||||||
|
|
||||||
|
registerSW({ immediate: true })
|
@ -13,8 +13,9 @@
|
|||||||
"vue": "^3.3.7"
|
"vue": "^3.3.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify-json/simple-icons": "^1.1.76",
|
"@iconify-json/carbon": "^1.1.21",
|
||||||
"@iconify-json/twemoji": "^1.1.12",
|
"@types/node": "^20.8.9",
|
||||||
|
"@vite-pwa/vitepress": "^0.2.3",
|
||||||
"prettier": "^3.0.3"
|
"prettier": "^3.0.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2733
pnpm-lock.yaml
generated
2733
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
20
tsconfig.json
Normal file
20
tsconfig.json
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"module": "esnext",
|
||||||
|
"target": "esnext",
|
||||||
|
"lib": ["DOM", "ESNext"],
|
||||||
|
"strict": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"strictNullChecks": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"types": ["vite/client", "vite-plugin-pwa/vanillajs", "vitepress"]
|
||||||
|
},
|
||||||
|
"include": ["./*.ts", "./.vitepress/**/*.ts"],
|
||||||
|
"exclude": ["dist", "node_modules"]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user