diff --git a/package-lock.json b/package-lock.json index 13e35ce..cffe5f5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -44,6 +44,7 @@ "lint-staged": "^16.4.0", "prettier": "^3.8.1", "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-svelte": "^3.5.1", "svelte-eslint-parser": "^1.6.0" }, "engines": { @@ -7768,6 +7769,17 @@ "dev": true, "license": "MIT" }, + "node_modules/prettier-plugin-svelte": { + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.5.1.tgz", + "integrity": "sha512-65+fr5+cgIKWKiqM1Doum4uX6bY8iFCdztvvp2RcF+AJoieaw9kJOFMNcJo/bkmKYsxFaM9OsVZK/gWauG/5mg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "prettier": "^3.0.0", + "svelte": "^3.2.0 || ^4.0.0-next.0 || ^5.0.0-next.0" + } + }, "node_modules/prismjs": { "version": "1.30.0", "resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.30.0.tgz", diff --git a/package.json b/package.json index e5f5114..185fbcf 100644 --- a/package.json +++ b/package.json @@ -62,6 +62,7 @@ "lint-staged": "^16.4.0", "prettier": "^3.8.1", "prettier-plugin-astro": "^0.14.1", + "prettier-plugin-svelte": "^3.5.1", "svelte-eslint-parser": "^1.6.0" } } diff --git a/prettier.config.cjs b/prettier.config.cjs index ca30f6d..bb11193 100644 --- a/prettier.config.cjs +++ b/prettier.config.cjs @@ -9,7 +9,7 @@ const config = { tabWidth: 2, semi: false, singleQuote: true, - plugins: ['prettier-plugin-astro'], + plugins: ['prettier-plugin-astro', 'prettier-plugin-svelte'], overrides: [ { files: '*.astro', diff --git a/scripts/generate_contact.py b/scripts/generate_contact.py new file mode 100644 index 0000000..9f35c40 --- /dev/null +++ b/scripts/generate_contact.py @@ -0,0 +1,47 @@ +import base64 +import json +from pathlib import Path + +raw_contact: list[dict[str, str]] = [ + { + "platform": "Github", + "href": "https://github.com/passthem-desu", + "name": "passthem-desu", + }, + { + "platform": "Wakatime", + "href": "https://wakatime.com/@passthem", + "name": "@passthem", + }, + { + "platform": "Youtube", + "href": "https://www.youtube.com/@Passthem183", + "name": "@Passthem183", + }, + { + "platform": "OtoSite", + "href": "https://otomad.site/@passthem", + "name": "@passthem", + }, + { + "platform": "Email", + "href": "mailto:passthem183@gmail.com", + "name": "passthem183@gmail.com", + }, + { + "platform": "Bilibili", + "href": "https://space.bilibili.com/92852604", + "name": "passthem", + }, +] + + +def hack(raw: str) -> str: + return base64.b64encode(raw[::-1].encode()).decode() + + +hacked_contact = [{k: hack(v) for k, v in c.items()} for c in raw_contact] +(Path(__file__).parent / "../src/lib/data").mkdir(exist_ok=True) +_ = (Path(__file__).parent / "../src/lib/data/contact.json").write_text( + json.dumps(hacked_contact) +) diff --git a/src/components/MainpageContactMe.svelte b/src/components/MainpageContactMe.svelte new file mode 100644 index 0000000..5536ad6 --- /dev/null +++ b/src/components/MainpageContactMe.svelte @@ -0,0 +1,98 @@ + + + + + {#each data as item} + + + + + {/each} + +
{unhack(item.platform)}{unhack(item.name)}
+ + diff --git a/src/lib/data/contact.json b/src/lib/data/contact.json new file mode 100644 index 0000000..d9accab --- /dev/null +++ b/src/lib/data/contact.json @@ -0,0 +1,32 @@ +[ + { + "platform": "YnVodGlH", + "href": "dXNlZC1tZWh0c3NhcC9tb2MuYnVodGlnLy86c3B0dGg=", + "name": "dXNlZC1tZWh0c3NhcA==" + }, + { + "platform": "ZW1pdGFrYVc=", + "href": "bWVodHNzYXBAL21vYy5lbWl0YWthdy8vOnNwdHRo", + "name": "bWVodHNzYXBA" + }, + { + "platform": "ZWJ1dHVvWQ==", + "href": "MzgxbWVodHNzYVBAL21vYy5lYnV0dW95Lnd3dy8vOnNwdHRo", + "name": "MzgxbWVodHNzYVBA" + }, + { + "platform": "ZXRpU290Tw==", + "href": "bWVodHNzYXBAL2V0aXMuZGFtb3RvLy86c3B0dGg=", + "name": "bWVodHNzYXBA" + }, + { + "platform": "bGlhbUU=", + "href": "bW9jLmxpYW1nQDM4MW1laHRzc2FwOm90bGlhbQ==", + "name": "bW9jLmxpYW1nQDM4MW1laHRzc2Fw" + }, + { + "platform": "aWxpYmlsaUI=", + "href": "NDA2MjU4MjkvbW9jLmlsaWJpbGliLmVjYXBzLy86c3B0dGg=", + "name": "bWVodHNzYXA=" + } +] diff --git a/src/pages/contact.astro b/src/pages/contact.astro deleted file mode 100644 index 2518273..0000000 --- a/src/pages/contact.astro +++ /dev/null @@ -1,9 +0,0 @@ ---- -import BoringLayout from '../layout/BoringLayout.astro' ---- - - -

联络我

-

邮箱:passthem183@gmail.com

-

点击 这里 返回主页

-
diff --git a/src/pages/index.astro b/src/pages/index.astro index 44c31d8..2fe0312 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -6,6 +6,7 @@ import FullLayoutV1 from '../layout/FullLayoutV1.astro' import MainpageButton from '../components/MainpageButton.svelte' import MainpageComments from '../components/MainpageComments.astro' import MainpageTypewriter from '../components/MainpageTypewriter.svelte' +import MainpageContactMe from '../components/MainpageContactMe.svelte' import { Image } from 'astro:assets' import { Icon } from 'astro-icon/components' import PassthemAvatar from '../assets/mainpage_avatars/passthem.png' @@ -102,41 +103,7 @@ try { > - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Githubpassthem-desu
Wakatime@passthem
Youtube@Passthem183
OtoSite@passthem
Emailpassthem183@gmail.com
Bilibilipassthem
+ @@ -614,74 +581,6 @@ try { transform: skewX(var(--skew-angle)) translateX(calc(var(--unit) - 1px)); } } - - & > table { - font-family: var(--font-mono); - - & caption { - text-align: center; - } - - & tr { - text-align: left; - display: grid; - grid-template-columns: 6em 16em; - gap: 1em; - line-height: 2em; - - @media (max-width: 767px) { - grid-template-columns: 18em; - gap: 0; - line-height: 1.8em; - margin-block: 1em; - } - - & th:nth-child(1) { - display: flex; - justify-content: space-between; - - @media (max-width: 767px) { - justify-content: left; - } - - &::after { - content: ':'; - } - } - - & th:nth-child(2) { - display: flex; - justify-content: space-between; - - @media (max-width: 767px) { - justify-content: end; - } - - &::before { - content: '['; - } - - &::after { - content: ']'; - } - - &:hover, - &:has(a:focus) { - background-color: var(--color-fg-0); - color: var(--color-bg-0); - } - - & > a { - text-align: center; - margin-inline: 1em; - - &:focus { - outline: none; - } - } - } - } - } } /* 友链页 */