Merge branch 'ccbikai:main' into main

This commit is contained in:
h1xy
2024-09-04 00:25:02 +08:00
committed by GitHub
11 changed files with 427 additions and 540 deletions

View File

@@ -5,7 +5,7 @@ permissions:
on:
schedule:
- cron: "0 0 * * *" # every day
- cron: '0 0 * * *' # every day
workflow_dispatch:
jobs:

View File

@@ -63,6 +63,13 @@ For detailed tutorials, see [Deploy your Astro site](https://docs.astro.build/en
## 🏗️ Deployment
### Docker
1. `docker pull ghcr.io/ccbikai/broadcastchannel:main`
2. `docker run -d --name broadcastchannel -p 4321:4321 -e CHANNEL=miantiao_me ghcr.io/ccbikai/broadcastchannel:main`
### Serverless
1. [Fork](https://github.com/ccbikai/BroadcastChannel/fork) this project to your GitHub
2. Create a project on Cloudflare/Netlify/Vercel
3. Select the `BroadcastChannel` project and the `Astro` framework

View File

@@ -63,6 +63,13 @@
## 🏗️ 部署
### Docker
1. `docker pull ghcr.io/ccbikai/broadcastchannel:main`
2. `docker run -d --name broadcastchannel -p 4321:4321 -e CHANNEL=miantiao_me ghcr.io/ccbikai/broadcastchannel:main`
### Serverless
1. [Fork](https://github.com/ccbikai/BroadcastChannel/fork) 此项目到你 GitHub
2. 在 Cloudflare/Netlify/Vercel 创建项目
3. 选择 `BroadcastChannel` 项目和 `Astro` 框架

View File

@@ -3,6 +3,7 @@ import antfu from '@antfu/eslint-config'
export default antfu({
formatters: true,
astro: true,
ignores: ['src/assets/style.css'],
rules: {
'no-console': ['error', { allow: ['info', 'warn', 'error'] }],
},

View File

@@ -3,7 +3,7 @@
"type": "module",
"version": "0.1.1",
"private": true,
"packageManager": "pnpm@9.8.0",
"packageManager": "pnpm@9.9.0",
"scripts": {
"dev": "astro dev",
"start": "astro dev",
@@ -16,7 +16,7 @@
},
"dependencies": {
"@astrojs/rss": "^4.0.7",
"@sentry/astro": "^8.26.0",
"@sentry/astro": "^8.27.0",
"cheerio": "1.0.0-rc.12",
"dayjs": "^1.11.13",
"flourite": "^1.3.0",
@@ -27,13 +27,13 @@
"sanitize-html": "^2.13.0"
},
"devDependencies": {
"@antfu/eslint-config": "^2.27.1",
"@antfu/eslint-config": "^3.0.0",
"@astrojs/cloudflare": "^11.0.4",
"@astrojs/netlify": "^5.5.1",
"@astrojs/node": "^8.3.3",
"@astrojs/vercel": "^7.8.0",
"@types/prismjs": "^1.26.4",
"astro": "^4.14.5",
"astro": "^4.15.1",
"astro-eslint-parser": "^1.0.2",
"astro-seo": "^0.8.4",
"autoprefixer": "^10.4.20",

840
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -168,10 +168,7 @@
margin: auto 2px;
border-radius: var(--box-border-radius);
background: #ccc 60% 60% / 3000px 3000px;
background-image: repeating-conic-gradient(
#999 0 0.0001%,
#0000 0 0.0002%
);
background-image: repeating-conic-gradient(#999 0 0.0001%, #0000 0 0.0002%);
}
input:checked + tg-spoiler {

View File

@@ -27,9 +27,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
<div id="header">
<a href={SITE_URL} title={channel?.title}>
<img
src={channel?.avatar?.startsWith('http')
? staticProxy + channel?.avatar
: voidFile.src}
src={channel?.avatar?.startsWith('http') ? staticProxy + channel?.avatar : voidFile.src}
alt={channel?.title}
loading="eager"
class="header-avatar"
@@ -41,13 +39,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
</a>
</div>
<div class="header-icons">
<a
href={`${SITE_URL}rss.xml`}
target="_blank"
rel="alternate"
type="application/rss+xml"
title="RSS Feed"
>
<a href={`${SITE_URL}rss.xml`} target="_blank" rel="alternate" type="application/rss+xml" title="RSS Feed">
<img {...rss} alt="RSS" class="social-icon" width="1em" />
</a>
@@ -61,17 +53,8 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
{
TWITTER && TWITTER.length > 0 && (
<a
href={`https://twitter.com/${TWITTER}`}
title="Twitter"
target="_blank"
>
<img
{...twitter}
alt={`twitter.com/${TWITTER}`}
class="social-icon"
width="1em"
/>
<a href={`https://twitter.com/${TWITTER}`} title="Twitter" target="_blank">
<img {...twitter} alt={`twitter.com/${TWITTER}`} class="social-icon" width="1em" />
</a>
)
}
@@ -79,12 +62,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
{
GITHUB && GITHUB.length > 0 && (
<a href={`https://github.com/${GITHUB}`} title="GitHub" target="_blank">
<img
{...github}
alt={`github.com/${GITHUB}`}
class="social-icon"
width="1em"
/>
<img {...github} alt={`github.com/${GITHUB}`} class="social-icon" width="1em" />
</a>
)
}
@@ -92,12 +70,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
{
TELEGRAM && TELEGRAM.length > 0 && (
<a href={`https://t.me/${TELEGRAM}`} title="Telegram" target="_blank">
<img
{...telegram}
alt={`t.me/${TELEGRAM}`}
class="social-icon"
width="1em"
/>
<img {...telegram} alt={`t.me/${TELEGRAM}`} class="social-icon" width="1em" />
</a>
)
}
@@ -105,12 +78,7 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
{
DISCORD && DISCORD.length > 0 && (
<a href={DISCORD} title="Discord" target="_blank">
<img
{...discord}
alt="Discord Invite"
class="social-icon"
width="1em"
/>
<img {...discord} alt="Discord Invite" class="social-icon" width="1em" />
</a>
)
}
@@ -118,29 +86,15 @@ const staticProxy = getEnv(import.meta.env, Astro, 'STATIC_PROXY') ?? '/static/'
{
MASTODON && MASTODON.length > 0 && (
<a href={`https://${MASTODON}`} title="Mastodon" target="_blank">
<img
{...mastodon}
alt={`@${MASTODON}`}
class="social-icon"
width="1em"
/>
<img {...mastodon} alt={`@${MASTODON}`} class="social-icon" width="1em" />
</a>
)
}
{
BLUESKY && BLUESKY.length > 0 && (
<a
href={`https://bsky.app/profile/${BLUESKY}`}
title="BlueSky"
target="_blank"
>
<img
{...bluesky}
alt={`@${BLUESKY}`}
class="social-icon"
width="1em"
/>
<a href={`https://bsky.app/profile/${BLUESKY}`} title="BlueSky" target="_blank">
<img {...bluesky} alt={`@${BLUESKY}`} class="social-icon" width="1em" />
</a>
)
}

View File

@@ -13,33 +13,20 @@ const { SITE_URL } = Astro.locals
const { post } = Astro.props
const datetime = dayjs(post.datetime).tz(timezone)
const timeago = datetime.isBefore(dayjs().subtract(1, 'w'))
? datetime.format('HH:mm · ll · ddd')
: datetime.fromNow()
const timeago = datetime.isBefore(dayjs().subtract(1, 'w')) ? datetime.format('HH:mm · ll · ddd') : datetime.fromNow()
---
<div class="item" style={{ 'view-transition-name': `post-${post.id}` }}>
<div class="time-box">
<div class="dot"></div>
<div class="time">
<a
href={`${SITE_URL}posts/${post.id}`}
title={post.datetime}
class="item-link">{timeago}</a
>
<a href={`${SITE_URL}posts/${post.id}`} title={post.datetime} class="item-link">{timeago}</a>
</div>
</div>
{
post.content.length > 0 && (
<div class={`text-box content`} set:html={post.content} />
)
}
{post.content.length > 0 && <div class={`text-box content`} set:html={post.content} />}
{
post.tags.length > 0 && (
<div
class="tag-box"
style={post.content.length === 0 ? 'padding-top: 30px;' : ''}
>
<div class="tag-box" style={post.content.length === 0 ? 'padding-top: 30px;' : ''}>
<div class="tag-icon" />
{post.tags.map((tag) => (
<a href={`/search/%23${tag}`} title={tag} class="tag">

View File

@@ -23,11 +23,7 @@ const afterCursor = posts[0]?.id
<div class="pages-container">
{
before && beforeCursor > 1 ? (
<a
href={`${SITE_URL}before/${beforeCursor}`}
title="Before"
class="page"
>
<a href={`${SITE_URL}before/${beforeCursor}`} title="Before" class="page">
Before
</a>
) : (

View File

@@ -27,9 +27,7 @@ export const prerender = false
<List channel={channel} before={false} after={false}>
<div slot="header" id="breadcrumb">
<img
src={channel?.avatar?.startsWith('http')
? staticProxy + channel?.avatar
: voidFile.src}
src={channel?.avatar?.startsWith('http') ? staticProxy + channel?.avatar : voidFile.src}
alt={channel?.title}
loading="eager"
class="breadcrumb-avatar"