new post and merge with upsteam 3a99081

This commit is contained in:
sevichecc 2022-09-03 13:04:22 +08:00
parent ad830f9463
commit f7bd62db4d
53 changed files with 694 additions and 308 deletions

33
.gitignore vendored
View file

@ -1,15 +1,24 @@
.DS_Store # build output
node_modules
.svelte-kit
/package
src/routes/**/
src/routes/*.md
static/
build build
.vercel_build_output/ static
.netlify/ .svelte-kit
.env.local .netlify
.env.**.local .vercel_build_output
myblog/urara/2022-06-12-appwrite.md
# dependencies
node_modules
# env
*.local
# logs
pnpm-debug.log*
# macOS-specific files
.DS_Store
# temp file
src/routes/**/+page.svelte.md
src/routes/**/+page.md
*.config.js *.config.js
urara.js urara.js

View file

@ -29,7 +29,7 @@ const remarkUraraFm =
if (!data.fm) data.fm = {} if (!data.fm) data.fm = {}
// Generate slug & path // Generate slug & path
data.fm.slug = filepath data.fm.slug = filepath
data.fm.path = join(dir, `/${name}`.replace('/index', '').replace('.svelte', '')) data.fm.path = join(dir, `/${name}`.replace('/+page', '').replace('.svelte', ''))
// Generate ToC // Generate ToC
if (data.fm.toc !== false) { if (data.fm.toc !== false) {
const [slugs, toc]: [slugs: Slugger, toc: { depth: number; title: string; slug: string }[]] = [new Slugger(), []] const [slugs, toc]: [slugs: Slugger, toc: { depth: number; title: string; slug: string }[]] = [new Slugger(), []]
@ -48,15 +48,6 @@ const remarkUraraFm =
if (!data.fm.created) data.fm.created = ctime if (!data.fm.created) data.fm.created = ctime
if (!data.fm.updated) data.fm.updated = mtime if (!data.fm.updated) data.fm.updated = mtime
} }
// Remark FFF Experimental (Hugo -> MDsveX)
Object.entries({
image: 'images',
tags: 'category',
bookmark_of: 'bookmarkOf',
like_of: 'likeOf',
repost_of: 'repostOf',
in_reply_to: 'inReplyTo'
}).forEach(([output, input]: string[]) => (data.fm = { ...data.fm, [output]: data.fm![input] }))
} }
// Better type definitions needed // Better type definitions needed

View file

@ -29,8 +29,8 @@
"zhlint": "zhlint urara/*/*.md --fix && zhlint urara/*.md --fix" "zhlint": "zhlint urara/*/*.md --fix && zhlint urara/*.md --fix"
}, },
"devDependencies": { "devDependencies": {
"@iconify-json/heroicons-outline": "^1.1.2", "@iconify-json/heroicons-outline": "^1.1.4",
"@iconify-json/heroicons-solid": "^1.1.2", "@iconify-json/heroicons-solid": "^1.1.5",
"@iconify-json/ic": "^1.1.9", "@iconify-json/ic": "^1.1.9",
"@iconify-json/simple-icons": "1.1.21", "@iconify-json/simple-icons": "1.1.21",
"@iconify-json/material-symbols": "1.1.14", "@iconify-json/material-symbols": "1.1.14",
@ -39,19 +39,19 @@
"@sveltejs/adapter-auto": "1.0.0-next.64", "@sveltejs/adapter-auto": "1.0.0-next.64",
"@sveltejs/adapter-node": "1.0.0-next.86", "@sveltejs/adapter-node": "1.0.0-next.86",
"@sveltejs/adapter-static": "1.0.0-next.39", "@sveltejs/adapter-static": "1.0.0-next.39",
"@sveltejs/kit": "1.0.0-next.405", "@sveltejs/kit": "1.0.0-next.456",
"@tailwindcss/typography": "^0.5.4", "@tailwindcss/typography": "^0.5.4",
"@types/node": "^18.7.8", "@types/node": "^18.7.14",
"@types/unist": "^2.0.6", "@types/unist": "^2.0.6",
"@typescript-eslint/eslint-plugin": "^5.33.1", "@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/parser": "^5.33.1", "@typescript-eslint/parser": "^5.36.1",
"autoprefixer": "^10.4.8", "autoprefixer": "^10.4.8",
"chalk": "^5.0.1", "chalk": "^5.0.1",
"chokidar": "^3.5.3", "chokidar": "^3.5.3",
"cross-env": "^7.0.3", "cross-env": "^7.0.3",
"cssnano": "^5.1.13", "cssnano": "^5.1.13",
"daisyui": "^2.24.0", "daisyui": "^2.24.0",
"eslint": "^8.22.0", "eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-svelte3": "^4.0.0", "eslint-plugin-svelte3": "^4.0.0",
"fenceparser": "^2.2.0", "fenceparser": "^2.2.0",
@ -68,19 +68,20 @@
"rehype-slug": "^5.0.1", "rehype-slug": "^5.0.1",
"remark": "^14.0.2", "remark": "^14.0.2",
"remark-footnotes": "~2.0.0", "remark-footnotes": "~2.0.0",
"remark-fff": "^0.3.0-alpha.1",
"shiki-twoslash": "^3.1.0", "shiki-twoslash": "^3.1.0",
"svelte": "^3.49.0", "svelte": "^3.49.0",
"svelte-bricks": "^0.1.7", "svelte-bricks": "^0.1.7",
"svelte-check": "^2.8.1", "svelte-check": "^2.9.0",
"svelte-preprocess": "^4.10.7", "svelte-preprocess": "^4.10.7",
"svelte-typeahead": "^4.2.4", "svelte-typeahead": "^4.2.4",
"tailwindcss": "^3.1.8", "tailwindcss": "^3.1.8",
"tslib": "^2.4.0", "tslib": "^2.4.0",
"typescript": "^4.7.4", "typescript": "^4.8.2",
"unist-util-visit": "^4.1.0", "unist-util-visit": "^4.1.1",
"unocss": "^0.45.8", "unocss": "^0.45.13",
"vite": "^3.0.9", "vite": "^3.1.0-beta.1",
"vite-plugin-pwa": "^0.12.3", "vite-plugin-pwa": "^0.12.4",
"workbox-window": "^6.5.4" "workbox-window": "^6.5.4"
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { dev } from '$app/env' import { dev } from'$app/environment'
let className = undefined let className = undefined
export { className as class } export { className as class }
export let src = undefined export let src = undefined

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { dev } from '$app/env' import { dev } from'$app/environment'
import { head } from '$lib/config/general' import { head } from '$lib/config/general'
import { site } from '$lib/config/site' import { site } from '$lib/config/site'
import OpenGraph from '$lib/components/head_opengraph.svelte' import OpenGraph from '$lib/components/head_opengraph.svelte'

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { browser, dev } from '$app/env' import { browser, dev } from '$app/environment'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import { site } from '$lib/config/site' import { site } from '$lib/config/site'
import { theme } from '$lib/config/general' import { theme } from '$lib/config/general'

View file

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { browser } from '$app/env' import { browser } from '$app/environment'
import { post as postConfig } from '$lib/config/post' import { post as postConfig } from '$lib/config/post'
import { posts as storedPosts } from '$lib/stores/posts' import { posts as storedPosts } from '$lib/stores/posts'
import { title as storedTitle } from '$lib/stores/title' import { title as storedTitle } from '$lib/stores/title'

View file

@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import { browser } from '$app/env' import { browser } from'$app/environment'
import Card from '$lib/components/post_card.svelte' import Card from '$lib/components/post_card.svelte'
import Head from '$lib/components/head.svelte' import Head from '$lib/components/head.svelte'
import Toc from '$lib/components/post_toc.svelte' import Toc from '$lib/components/post_toc.svelte'

View file

@ -135,7 +135,8 @@ export const head: HeadConfig = {
// Block Baiduspider // Block Baiduspider
'<meta name="baiduspider" content="noindex,noarchive">', '<meta name="baiduspider" content="noindex,noarchive">',
// Microsub // Microsub
'<link rel="microsub" href="https://aperture.p3k.io/microsub/761">' '<link rel="microsub" href="https://aperture.p3k.io/microsub/761">'
], ],
me: ['https://kongwoo.icu/@seviche'] me: ['https://kongwoo.icu/@seviche']
} }

View file

@ -1,18 +1,11 @@
<script lang="ts" context="module">
import type { Load } from './__types'
export const load: Load = ({ url: { pathname }, error, status }) => ({ props: { pathname, error, status } })
</script>
<script lang="ts"> <script lang="ts">
import { page } from '$app/stores'
import Head from '$lib/components/head.svelte' import Head from '$lib/components/head.svelte'
import Footer from '$lib/components/footer.svelte' import Footer from '$lib/components/footer.svelte'
export let pathname: string console.error($page.status, $page.error.message)
export let error: Error
export let status: string
console.error(status, error.message)
</script> </script>
<Head page={{ title: status ?? '404', path: pathname ?? '/404' }} /> <Head page={{ title: $page.status.toString() ?? '404', path: $page.url.pathname }} />
<div class="flex flex-col flex-nowrap justify-center xl:flex-row xl:flex-wrap"> <div class="flex flex-col flex-nowrap justify-center xl:flex-row xl:flex-wrap">
<div class="flex-none w-full max-w-screen-md mx-auto xl:mx-0"> <div class="flex-none w-full max-w-screen-md mx-auto xl:mx-0">
@ -22,9 +15,9 @@
class="card bg-base-100 rounded-none md:rounded-box shadow-xl md:mb-8 z-10"> class="card bg-base-100 rounded-none md:rounded-box shadow-xl md:mb-8 z-10">
<main itemprop="articleBody" class="card-body prose urara-prose"> <main itemprop="articleBody" class="card-body prose urara-prose">
<h1 class="opacity-20 text-6xl md:text-[12rem] -mt-2 mb-0"> <h1 class="opacity-20 text-6xl md:text-[12rem] -mt-2 mb-0">
{status ?? '404'} {$page.status ?? '404'}
</h1> </h1>
<h2 class="-mt-12 md:-mt-24">{error.message ?? 'Not found'}</h2> <h2 class="-mt-12 md:-mt-24">{$page.error.message ?? 'Not found'}</h2>
<div class="card-actions"> <div class="card-actions">
<a href="/" class="btn btn-neutral no-underline shadow-xl hover:shadow-2xl mt-8"> <a href="/" class="btn btn-neutral no-underline shadow-xl hover:shadow-2xl mt-8">
<span class="i-heroicons-outline-home -ml-1 mr-2" /> <span class="i-heroicons-outline-home -ml-1 mr-2" />

View file

@ -1,17 +1,7 @@
<script lang="ts" context="module">
import type { Load } from './__types'
export const prerender = true
export const load: Load = async ({ url, fetch }) => ({
props: {
path: url.pathname,
res: await fetch('/posts.json').then(res => res.json())
}
})
</script>
<script lang="ts"> <script lang="ts">
import type { LayoutData } from './$types'
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { browser, dev } from '$app/env' import { browser, dev } from '$app/environment'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import { genTags } from '$lib/utils/posts' import { genTags } from '$lib/utils/posts'
import { posts, tags } from '$lib/stores/posts' import { posts, tags } from '$lib/stores/posts'
@ -20,10 +10,11 @@
import Header from '$lib/components/header.svelte' import Header from '$lib/components/header.svelte'
import 'uno.css' import 'uno.css'
import '../app.css' import '../app.css'
export let res: Urara.Post[]
export let path: string export let data: LayoutData
posts.set(res)
tags.set(genTags(res)) posts.set(data.res)
tags.set(genTags(data.res))
onMount( onMount(
() => () =>
!dev && !dev &&
@ -37,9 +28,9 @@
<Head /> <Head />
<Header {path} /> <Header path={data.path} />
{#key path} {#key data.path}
<div <div
class="bg-base-100 md:bg-base-200 min-h-screen pt-16 md:pb-8 lg:pb-16" class="bg-base-100 md:bg-base-200 min-h-screen pt-16 md:pb-8 lg:pb-16"
in:fly={{ y: 100, duration: 300, delay: 300 }} in:fly={{ y: 100, duration: 300, delay: 300 }}

6
src/routes/+layout.ts Normal file
View file

@ -0,0 +1,6 @@
import type { LayoutLoad } from './$types'
export const prerender = true
export const load: LayoutLoad = async ({ url, fetch }) => ({
path: url.pathname,
res: await fetch('/posts.json').then(res => res.json())
})

View file

@ -2,7 +2,7 @@
import { onMount } from 'svelte' import { onMount } from 'svelte'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
import { page } from '$app/stores' import { page } from '$app/stores'
import { browser } from '$app/env' import { browser } from '$app/environment'
import { posts as storedPosts, tags as storedTags } from '$lib/stores/posts' import { posts as storedPosts, tags as storedTags } from '$lib/stores/posts'
import { title as storedTitle } from '$lib/stores/title' import { title as storedTitle } from '$lib/stores/title'
import Head from '$lib/components/head.svelte' import Head from '$lib/components/head.svelte'
@ -10,7 +10,6 @@
import Post from '$lib/components/post_card.svelte' import Post from '$lib/components/post_card.svelte'
// import Post from '$lib/components/index_post.svelte' // import Post from '$lib/components/index_post.svelte'
import Profile from '$lib/components/index_profile.svelte' import Profile from '$lib/components/index_profile.svelte'
import RemoteFollow from '$lib/components/extra/follow.svelte'
let allPosts: Urara.Post[] let allPosts: Urara.Post[]
let allTags: string[] let allTags: string[]
@ -125,5 +124,3 @@
{/key} {/key}
</div> </div>
</div> </div>
<RemoteFollow />

View file

@ -1,12 +1,12 @@
import type { RequestHandler } from '@sveltejs/kit' import type { RequestHandler } from './$types'
import { site } from '$lib/config/site' import { site } from '$lib/config/site'
import { feed } from '$lib/config/general' import { feed } from '$lib/config/general'
import { favicon } from '$lib/config/icon' import { favicon } from '$lib/config/icon'
import { genPosts, genTags } from '$lib/utils/posts' import { genPosts, genTags } from '$lib/utils/posts'
const render = async ( const render = (
posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true }) posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })
): Promise<string> => `<?xml version='1.0' encoding='utf-8'?> ): string => `<?xml version='1.0' encoding='utf-8'?>
<feed xmlns="http://www.w3.org/2005/Atom"> <feed xmlns="http://www.w3.org/2005/Atom">
<id>${site.protocol + site.domain}/</id> <id>${site.protocol + site.domain}/</id>
<title><![CDATA[${site.title}]]></title>${site.subtitle ? `\n <subtitle><![CDATA[${site.subtitle}]]></subtitle>` : ''}${ <title><![CDATA[${site.title}]]></title>${site.subtitle ? `\n <subtitle><![CDATA[${site.subtitle}]]></subtitle>` : ''}${
@ -41,9 +41,10 @@ const render = async (
.join('')} .join('')}
</feed>` </feed>`
export const GET: RequestHandler = async () => ({ export const prerender = true
headers: { export const GET: RequestHandler = async () =>
'Content-Type': 'application/atom+xml; charset=utf-8' new Response(render(), {
}, headers: {
body: await render() 'content-type': 'application/atom+xml; charset=utf-8'
}) }
})

View file

@ -1,10 +1,10 @@
import type { RequestHandler } from '@sveltejs/kit' import type { RequestHandler } from './$types'
import { site } from '$lib/config/site' import { site } from '$lib/config/site'
import { feed } from '$lib/config/general' import { feed } from '$lib/config/general'
import { favicon, any } from '$lib/config/icon' import { favicon, any } from '$lib/config/icon'
import { genPosts } from '$lib/utils/posts' import { genPosts } from '$lib/utils/posts'
const render = async (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })) => ({ const render = (posts = genPosts({ postHtml: true, postLimit: feed.limit, filterUnlisted: true })) => ({
version: 'https://jsonfeed.org/version/1.1', version: 'https://jsonfeed.org/version/1.1',
title: site.title, title: site.title,
home_page_url: site.protocol + site.domain, home_page_url: site.protocol + site.domain,
@ -41,9 +41,10 @@ const render = async (posts = genPosts({ postHtml: true, postLimit: feed.limit,
})) }))
}) })
export const GET: RequestHandler = async () => ({ export const prerender = true
headers: { export const GET: RequestHandler = async () =>
'Content-Type': 'application/feed+json; charset=utf-8' new Response(JSON.stringify(render(), null, 2), {
}, headers: {
body: JSON.stringify(await render(), null, 2) 'content-type': 'application/feed+json; charset=utf-8'
}) }
})

View file

@ -1,32 +0,0 @@
import type { RequestHandler } from '@sveltejs/kit'
import { site } from '$lib/config/site'
import { any, maskable } from '$lib/config/icon'
export const GET: RequestHandler = () => ({
headers: {
'Content-Type': 'application/manifest+json; charset=utf-8'
},
body: JSON.stringify(
{
name: site.title,
short_name: site.title,
lang: site.lang,
description: site.description,
id: site.protocol + site.domain + '/',
start_url: '/',
scope: '/',
display: 'standalone',
orientation: 'portrait',
background_color: site.themeColor,
theme_color: site.themeColor,
icons: [
...Object.values(any)
.filter(icon => icon.sizes !== '180x180')
.map(icon => ({ ...icon, purpose: 'any' })),
...Object.values(maskable).map(icon => ({ ...icon, purpose: 'maskable' }))
]
},
null,
2
)
})

View file

@ -0,0 +1,36 @@
import type { RequestHandler } from './$types'
import { site } from '$lib/config/site'
import { any, maskable } from '$lib/config/icon'
export const prerender = true
export const GET: RequestHandler = () =>
new Response(
JSON.stringify(
{
name: site.title,
short_name: site.title,
lang: site.lang,
description: site.description,
id: site.protocol + site.domain + '/',
start_url: '/',
scope: '/',
display: 'standalone',
orientation: 'portrait',
background_color: site.themeColor,
theme_color: site.themeColor,
icons: [
...Object.values(any)
.filter(icon => icon.sizes !== '180x180')
.map(icon => ({ ...icon, purpose: 'any' })),
...Object.values(maskable).map(icon => ({ ...icon, purpose: 'maskable' }))
]
},
null,
2
),
{
headers: {
'Content-Type': 'application/manifest+json; charset=utf-8'
}
}
)

View file

@ -1,9 +0,0 @@
import type { RequestHandler } from '@sveltejs/kit'
import { genPosts } from '$lib/utils/posts'
export const GET: RequestHandler = async () => ({
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify(genPosts(), null, 2)
})

View file

@ -0,0 +1,10 @@
import type { RequestHandler } from './$types'
import { genPosts } from '$lib/utils/posts'
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(genPosts(), null, 2), {
headers: {
'content-type': 'application/json; charset=utf-8'
}
})

View file

@ -1,8 +1,8 @@
import type { RequestHandler } from '@sveltejs/kit' import type { RequestHandler } from './$types'
import { site } from '$lib/config/site' import { site } from '$lib/config/site'
import { genPosts } from '$lib/utils/posts' import { genPosts } from '$lib/utils/posts'
const render = async (): Promise<string> => `<?xml version='1.0' encoding='utf-8'?> const render = (): string => `<?xml version='1.0' encoding='utf-8'?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url> <url>
<loc>${site.protocol + site.domain}</loc> <loc>${site.protocol + site.domain}</loc>
@ -19,9 +19,10 @@ const render = async (): Promise<string> => `<?xml version='1.0' encoding='utf-8
.join('')} .join('')}
</urlset>` </urlset>`
export const GET: RequestHandler = async () => ({ export const prerender = true
headers: { export const GET: RequestHandler = async () =>
'Content-Type': 'application/xml; charset=utf-8' new Response(render(), {
}, headers: {
body: await render() 'content-type': 'application/xml; charset=utf-8'
}) }
})

View file

@ -1,9 +0,0 @@
import type { RequestHandler } from '@sveltejs/kit'
import { genPosts, genTags } from '$lib/utils/posts'
export const GET: RequestHandler = async () => ({
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
body: JSON.stringify(genTags(genPosts()), null, 2)
})

View file

@ -0,0 +1,10 @@
import type { RequestHandler } from './$types'
import { genPosts, genTags } from '$lib/utils/posts'
export const prerender = true
export const GET: RequestHandler = async () =>
new Response(JSON.stringify(genTags(genPosts()), null, 2), {
headers: {
'Content-Type': 'application/json; charset=utf-8'
}
})

View file

@ -1,12 +1,13 @@
// sveltekit config type // sveltekit config type
import type { Config } from '@sveltejs/kit' import type { Config } from '@sveltejs/kit'
// svelte preprocess // svelte adapter
import preprocess from 'svelte-preprocess'
import adapterAuto from '@sveltejs/adapter-auto' import adapterAuto from '@sveltejs/adapter-auto'
import adapterNode from '@sveltejs/adapter-node' import adapterNode from '@sveltejs/adapter-node'
import adapterStatic from '@sveltejs/adapter-static' import adapterStatic from '@sveltejs/adapter-static'
// svelte preprocessor
import { mdsvex } from 'mdsvex' import { mdsvex } from 'mdsvex'
import mdsvexConfig from './mdsvex.config.js' import mdsvexConfig from './mdsvex.config.js'
import preprocess from 'svelte-preprocess'
const defineConfig = (config: Config) => config const defineConfig = (config: Config) => config
@ -23,7 +24,6 @@ export default defineConfig({
assets: 'build', assets: 'build',
fallback: undefined fallback: undefined
}), }),
csp: { mode: 'auto' }, csp: { mode: 'auto' }
prerender: { default: true }
} }
}) })

View file

@ -1,32 +1,14 @@
// tailwind config type // @ts-ignore Could not find a declaration file for module '@tailwindcss/typography'.
import type { TailwindConfig } from 'tailwindcss/tailwind-config'
// @ts-ignore TS2305: Module 'tailwindcss/plugin' has no exported member 'TailwindPluginWithoutOptions'.
import type { TailwindPluginWithoutOptions } from 'tailwindcss/plugin'
// tailwind plugins
import typography from '@tailwindcss/typography' import typography from '@tailwindcss/typography'
// @ts-ignore Could not find a declaration file for module 'daisyui'.
import daisyui from 'daisyui' import daisyui from 'daisyui'
interface Config extends TailwindConfig { export default {
daisyui?: {
styled?: boolean
themes?: boolean | string[]
base?: boolean
utils?: boolean
logs?: boolean
rtl?: boolean
darkTheme?: string
prefix?: string
}
}
const defineConfig = (config: Config) => config
export default defineConfig({
content: ['./src/**/*.{html,md,js,svelte,ts}'], content: ['./src/**/*.{html,md,js,svelte,ts}'],
theme: { theme: {
extend: {} extend: {}
}, },
plugins: [typography as TailwindPluginWithoutOptions, daisyui as TailwindPluginWithoutOptions], plugins: [typography, daisyui],
daisyui: { daisyui: {
themes: [ themes: [
'light', 'light',
@ -60,4 +42,4 @@ export default defineConfig({
'winter' 'winter'
] ]
} }
}) }

View file

@ -9,7 +9,7 @@ import chokidar from 'chokidar'
import chalk from 'chalk' import chalk from 'chalk'
const config = { const config = {
extensions: ['svelte', 'md', 'js', 'ts'], extensions: ['md'],
catch: ['ENOENT', 'EEXIST'] catch: ['ENOENT', 'EEXIST']
} }

View file

@ -0,0 +1,126 @@
---
title: 我在看什么 · 8 月
created: 2022-09-02
summary: eval / CSP&XSS / Commonplace Book ……
tags:
- 我在看什么
image: /2022-09-02-reading-8/Augest.png
---
## 小碎步
- [翻译练习:如何损失金钱和时间](https://mp.weixin.qq.com/s/fyK0gp8rcaDnOJqfSAJFrw)
> 几天前我意识到一些让人吃惊的事:人们在时间上发生的状况和在金钱上发生的状况很类似。损失时间最危险的方式不是花时间去玩耍,而是去做假工作。
> 天性和教养相结合,使得我们避免自我放纵。但今天的世界已经变得更为复杂:现在最危险的陷阱是一些新的行为,这些行为会通过模仿更具德行的行为来绕过针对自我放纵的报警器。最糟糕的是,它们甚至都不好玩。
- [为语言多样性现象点灯之作——《〈役割語〉小辞典》读后感](http://www.acgpiping.net/2022/10143/bookreview_9784767491134/)
> 在阅读本书的过程中,我也不断思考,为什么在中文的中文作品里,似乎我感觉不到有那么多丰富的「役割語」呢?当然也不是说完全没有,例如北京的儿化音、上海人角色的「阿拉」,四川人角色的「脑斧」(「老虎」的 l 音变为 n 音)……不过或许是我阅读中文文学作品也并不多的原因吧,总感觉没有日语里那么多的对话变形现象。
- [“速通‘老头环’,但是小学生”](https://www.chuapp.com/article/288815.html)
触乐的文章都挺有意思的
- [蝴蝶并非个人专属](https://mp.weixin.qq.com/s/ToLKgr9q92HEYAnHb4ieXw)
一篇抄袭澄清文,对这个事件不太了解,我是被标题吸引进来的,很喜欢这句话:「蝴蝶并非个人专属」
- [《罗福兴,走出杀马特》](https://www.chuapp.com/article/288824.html)
再次,触乐的文章写得真好。
> 戏里还原了他前半生的经历:进过厂,开过美发室,拍过纪录片,搞过直播,做过装置艺术,演过话剧,但毫无例外地,他身上发生的一切都跟杀马特相关。他试图逃离这个定义,但杀马特又把他留在这里。
> 这种认知在 2013 年达到了顶峰,“反三俗”的社会气氛中,杀马特被当成低俗典型,人们“围剿”这些顶着夸张发型的年轻人,杀马特聚集的各大 QQ 群被解散,平台封杀。一些落单的杀马特在出门吃饭时被打,工厂也不再招收他们。
>
> 这成了杀马特消失的最直接原因——没法进厂,就没饭吃。大批杀马特在一夜之间消失,包括罗福兴。
> “偶尔有几个顺着微信找我,想借几百块钱还花呗,我 ×,几百块,还花呗。” 罗福兴叹了口气,声音沉下来,长久的沉默后说:“我觉得好难受。”
- [THE TASTE FOR ASS | Real Changzhou](https://realchangzhou.org/2022/07/08/the-taste-for-ass/)
作者是一位大学老师,有次学生做 presentation 的时候介绍驴肉火烧时说味道是 **the taste of ass**,他笑喷了,然后他决定去试试驴肉火烧到底是什么
> There was even a picture of the beloved Shrek character Donkey on the wall. I am not kidding.
> I cannot stop myself.  Do I like eating ass? Yes. Have I hit the streets looking for ass? Yes.  Do I like getting my hands around more ass? Yes. Do I wish I had more ass in my life? Yes.
- 关于苹果位置标注的时间维度问题,作者之前标注为 Facebook 的照片最近自动变成了 Meta由此展开了一番讨论
- [Place name mappings probably need a time dimension too](https://rachelbythebay.com/w/2022/06/15/places/)
- [More on geo-tagging photos with a time element](https://rachelbythebay.com/w/2022/06/20/exif/)
> The best I can figure so far is that youd send back a list of ALL of the place names for a given area and let the device figure out which times apply to which photos, and just discard the rest. Also, it should probably be “zoomed out” pretty far, such that only very coarse bounds are given to the server. Just return all of the mappings for all of the polygons or whatever inside some giant swath of space, and do all of the nitty gritty stuff on their device.
## 前端
- [Avoiding `<img\>` layout shifts: aspect-ratio vs width & height attributes](https://jakearchibald.com/2022/img-aspect-ratio/)
关于图片占位符,提到了两种方法: 1.固定纵横比aspect-ratio 结合 object-fit 2.根据内容确定:用 width 和 height 固定,其中可以设置 height 为 auto
- [Reflect.get()](https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Reflect/get)
- [How to use Ant Design with Vue 3](https://blog.logrocket.com/use-ant-design-vue-3/)
感觉这些组件库用起来都差不多
- [You Are Using Emojis The Wrong Way](https://dev.to/iamludal/you-are-using-emojis-the-wrong-way-i71)
要搭配着下面的评论看
- [尼姆游戏](https://zh.wikipedia.org/wiki/%E5%B0%BC%E5%A7%86%E6%B8%B8%E6%88%8F)
- [奇异局势](https://blog.csdn.net/u011519618/article/details/13749311)
- [重学递归](https://juejin.cn/post/703877204904037582)
- [大厂的 SDK 写法,偷学到了!](https://juejin.cn/post/7004695364896817183)
- 关于浏览器拓展的两篇文章,图片解释得蛮清楚的:
- [Browser extensions - our first extension](https://daily-dev-tips.com/posts/browser-extensions-our-first-extension/)
- [Browser extensions - our first theme](https://daily-dev-tips.com/posts/browser-extensions-our-first-theme/)
- [Delete unused node_modules in a second and enjoy some free space!](https://dev.to/this-is-learning/delete-unused-nodemodules-in-a-second-and-enjoy-some-free-space-f3p)
- 清除电脑上多余的 node 包,不过一开始就用 pnpm 会更好
- 安装:`npm i -g npkill`
- 启动:`npx npkill`
- 按大小排序结果:`npx npkill -s size`
- 上下方向键选择,空格删除,`Q` or `Ctrl + c`推出
- Repo[GitHub - voidcosmos/npkill](https://github.com/voidcosmos/npkill)
* [JS replaceAll 和 matchAll 使用指南不指北 ](https://www.zhangxinxu.com/wordpress/2022/08/js-replaceall-matchall/)
* [tdarb.org / Making a Website Under 1kB](https://tdarb.org/blog/under-1kb.html)
* [HTTP 协议中 URI 和 URL 有什么区别?](https://www.zhihu.com/question/21950864/answer/158161453)
* [You Do Not Need a Plugin for This - jdhaos digital space](https://jdhao.github.io/2022/08/21/you-do-not-need-a-plugin-for-this/)
给 Neovim 新手的一些建议,比起一开始就安装很多的外部插件,作者建议尝试写自己需要的插件
## 编程相关
- [使用元素间索引](https://6cdh.github.io/posts/index_between_elements/)
- [Git In Two Minutes (For A Solo Developer)](https://www.garyrobinson.net/2014/10/git-in-two-minutes-for-a-solo-developer.html)
- [如何给你的代码祝寿](https://tw93.fun/2022-07-09/code.html)
- [How to Learn to Code](https://headlinedev.xyz/2022/08/12/how-to-learn-to-program.html)
> - Learn by doing, have resources available to assist you and apply them.
> - Understand that learning to program involves making thousands of tiny mistakes, you can recover from them!
> - Get help. Thousands of developers lurk in different chat rooms wanting to assist you, the programming community is amazing in this aspect.
> - If you cannot finish your project, aim lower and try again.
> - If you can finish your project, post it in a public chat room and ask for critique.
* [软件工程是个面包机](https://drmingdrmer.github.io/tech/bla/2018/09/27/toaster.html)
> - 软件工程就像人类社会一样, 绝大多数人的工作不是制作”面包机”这种最终产品的. 大部分人的工作是提供零件和支持 :
> - **而研发体系的建设, 也像面包机项目一样, 它的成功与否, 取决于是否能让一个工程师把精力集中在业务核心的思考上, 也就是说, 取决于是否在这个工程师背后有一个支撑他的完善工具体系**.
> - IT 也不同于传统业: IT 行业中, 信息的复制, 经验的复制, 都不需要额外的实体成本, 它的每个成果都是可以零(实物)成本传递给其他人的.
> - 互相支持就是为其他人提供可以用的东西, 而且这个东西必须是可靠的.
> - 就像一个精确符合标准的螺丝钉, 可以让再次使用它的人, 免除后顾之忧. 耦合紧密, 无需担心松动脱落.
> - 如果要发现软件质量的问题, 短期内没有非常好的方法, 但长期上也可以用比较简单的方法可以量化出来, 关注 2 个概念: 代码的  **增长率**  **丢弃率**
> - 代码可读性 \> review \> 文档 \> 测试
* [技术管理猪鸡-1 开篇](https://blog.youxu.info/2015/05/17/tech-lead-1/)
> 做技术领导时也是一样,许多我们知道的常识性的东西,一旦遇到复杂情况,我们往往依赖于旧习惯和情绪反应,忘了要解决的问题,忘了运用常识做出正确的判断。
> 技术管理的模型本身多种多样。人月神话模型人件模型丰田模型温伯格模型Agile 模型Lean 模型等等不可枚举。对于一个技术管理人员来说,幸运的是,所有的模型都是错的,所以即使不知道这些模型,也未必遗漏了什么重要的。不幸的是,有些模型的确比较有用,所以知道一些还是有好处的。
* [The Chicken and the Pig - Wikipedia](https://en.wikipedia.org/wiki/The_Chicken_and_the_Pig)
- [独立开发变现周刊(第 67 期):如何建立了一个年收入 42 万美元的业务,将播客转化为文章](https://www.ezindie.com/weekly/issue-67)
> 在早期,你的 logo 和你的网站并不重要——尤其是当你提供服务的时候。修补品牌和网站可能很有趣,但这不会帮助你获得客户。在早期,你的 logo 不会让你在市场上脱颖而出,你的网站也不太可能在一开始就帮你实现任何转变。
>
> 相反,专注于与客户交谈,并开发解决问题的解决方案。不要忙于制作一个漂亮的标志和花哨的网站。

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 778 KiB

View file

@ -1,16 +1,16 @@
// vite define config // vite define config
import { defineConfig } from 'vite' import { defineConfig } from 'vite'
// vite sveltekit
import { sveltekit } from '@sveltejs/kit/vite'
// vite plugin // vite plugin
import UnoCSS from 'unocss/vite' import UnoCSS from 'unocss/vite'
import { presetTagify, presetIcons, extractorSvelte } from 'unocss' import { presetTagify, presetIcons, extractorSvelte } from 'unocss'
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from 'vite-plugin-pwa'
import { sveltekit } from '@sveltejs/kit/vite'
// postcss & tailwindcss // postcss & tailwindcss
import TailwindCSS from 'tailwindcss' import TailwindCSS from 'tailwindcss'
import tailwindConfig from './tailwind.config' import tailwindConfig from './tailwind.config'
import autoprefixer from 'autoprefixer' import autoprefixer from 'autoprefixer'
import cssnano from 'cssnano' import cssnano from 'cssnano'
export default defineConfig({ export default defineConfig({
envPrefix: 'URARA_', envPrefix: 'URARA_',
css: { css: {