Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/ISSUE_TEMPLATE/artwork.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: "上传绘画作品"
description: "手机选择照片,填写作品信息。仅 hulingjun 提交的作品会发布到画展。"
title: "[画作] "
body:
- type: markdown
attributes:
value: |
## 留下这一幅画
一幅作品新建一条记录。提交后通常几分钟内自动发布到 https://hulingjun.github.io/art/ 。

**图片一上传到 GitHub 就可能被公开访问,包括原始照片。** 请先裁掉姓名、学校、住址等信息,并在手机分享照片时移除位置。画展中的处理版会去掉照片元数据,但不会删除 GitHub 的原始附件。
- type: input
id: artwork-title
attributes:
label: 作品名称
placeholder: 例如:彩色的夏天
validations:
required: true
- type: input
id: artwork-date
attributes:
label: 创作日期
description: "格式 YYYY-MM-DD。不记得具体日期可以留空,不会以上传日期代替。"
placeholder: "2026-09-05"
- type: textarea
id: artwork-photo
attributes:
label: 作品图片
description: "点输入框下方的附件按钮,选择手机相册中的一张照片。支持 JPG、PNG、WebP、GIF,最大 10 MB。HEIC 请先转成 JPG;GIF 只展示首帧。不要删除上传后自动出现的图片链接。"
placeholder: 在这里添加一张画作照片
validations:
required: true
- type: textarea
id: artwork-story
attributes:
label: 作品故事
description: 可选,记录她画这幅画时说的话,最多 1200 字。请勿填写私人信息。
placeholder: 她说……
- type: checkboxes
id: public-consent
attributes:
label: 公开确认
options:
- label: 我确认只上传可公开展示的画作,不含孩子的姓名、学校、住址等隐私。
required: true
- type: markdown
attributes:
value: |
提交后请保持记录为 Open(打开)。编辑上面的信息会更新画展;Close issue(关闭记录)会下架,Reopen(重新打开)会恢复。
下架不会自动删除 GitHub 的原始附件。发布结果见本记录下的自动回复。
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/growth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "写一条成长记录"
description: "记录自己的思考,或女儿的一次新发现。"
title: "[成长] "
body:
- type: dropdown
id: scope
attributes:
label: 记录归属
options:
- 我的成长
- 女儿的成长
validations:
required: true
- type: input
id: heading
attributes:
label: 记录标题
placeholder: 今天,理解了一件小事
validations:
required: true
- type: input
id: date
attributes:
label: 记录日期
placeholder: "2026-09-05"
description: "填写 YYYY-MM-DD,例如 2026-09-05。"
validations:
required: true
- type: textarea
id: content
attributes:
label: 记录正文
description: 写下这次经历、发现或思考。支持换行,以纯文字展示,最多 10000 字。
validations:
required: true
- type: checkboxes
id: consent
attributes:
label: 公开确认
options:
- label: 我确认这份记录可以在公开网站和 GitHub 仓库中展示。
required: true
- type: markdown
attributes:
value: |
仅 hulingjun 的记录会进入网站。不要填写孩子的姓名、学校、位置或其他隐私。
编辑本记录会更新网站,关闭记录会从网站下架。GitHub 历史仍保留。
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/knowledge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "保存知识空间"
description: "把编辑器复制的知识数据保存到 GitHub,自动进入成长档案。"
title: "[知识] "
body:
- type: markdown
attributes:
value: |
请使用 hulingjun 登录。从知识空间点击“保存到 GitHub”,复制完整数据后粘贴到下方。
同一个空间的新提交会成为最新版本;旧版本留在 GitHub 历史中。只提交准备公开的内容。
如需私密知识存储,不要在这里提交:当前仓库与网站均为公开。
- type: textarea
id: knowledge-data
attributes:
label: 知识数据
description: 粘贴从编辑器复制的完整 JSON。请勿修改 spaceId。
render: json
validations:
required: true
- type: checkboxes
id: consent
attributes:
label: 公开确认
options:
- label: 我确认这份记录可以在公开网站和 GitHub 仓库中展示。
required: true
42 changes: 42 additions & 0 deletions .github/workflows/archive-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Validate growth archive
on:
pull_request:
branches: [main]
push:
branches: [agent/github-art-gallery]
permissions:
contents: read
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: actions/setup-node@v4
with:
node-version: 22
- run: npm install
- name: Install isolated image processing tools
run: npm install --prefix "$RUNNER_TEMP/gallery-tools" --no-package-lock --no-save sharp@0.35.4
- name: Validate records, permissions and image processing
run: node --test scripts/archive.test.mjs
env:
GALLERY_TOOLS_DIR: ${{ runner.temp }}/gallery-tools
- name: Build empty archive fixture
run: |
node scripts/build-gallery.mjs
node scripts/sync-records.mjs
npm run build
env:
GALLERY_TOOLS_DIR: ${{ runner.temp }}/gallery-tools
GALLERY_FIXTURE: scripts/fixtures/empty.json
- name: Check published routes and public data
run: |
test -s github-dist/index.html
test -s github-dist/art/index.html
test -s github-dist/learning/index.html
test -s github-dist/knowledge/index.html
test -s github-dist/3d-alpha/index.html
test -s github-dist/art-data/manifest.json
test -s github-dist/records/index.json
69 changes: 65 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,93 @@ on:
push:
branches: [main]
workflow_dispatch:
issues:
types: [opened, edited, closed, reopened, deleted]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: true
cancel-in-progress: false
jobs:
build-and-deploy:
if: >-
github.event_name != 'issues' ||
(github.event.sender.login == github.repository_owner &&
github.event.issue.user.login == github.repository_owner &&
(startsWith(github.event.issue.title, '[画作]') ||
startsWith(github.event.issue.title, '[知识]') ||
startsWith(github.event.issue.title, '[成长]') ||
startsWith(github.event.changes.title.from, '[画作]') ||
startsWith(github.event.changes.title.from, '[知识]') ||
startsWith(github.event.changes.title.from, '[成长]')))
permissions:
contents: write
issues: write
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
fetch-depth: 1
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Build static 2D and 3D site
- name: Install isolated image processing tools
run: npm install --prefix "$RUNNER_TEMP/gallery-tools" --no-package-lock --no-save sharp@0.35.4
- name: Validate archive security and image processing
run: node --test scripts/archive.test.mjs
env:
GALLERY_TOOLS_DIR: ${{ runner.temp }}/gallery-tools
- name: Prepare owner artwork and growth records
run: |
node scripts/build-gallery.mjs
node scripts/sync-records.mjs
env:
GITHUB_TOKEN: ${{ github.token }}
GALLERY_TOOLS_DIR: ${{ runner.temp }}/gallery-tools
- name: Build website
run: npm run build
- name: Save knowledge and journal files in GitHub
run: |
git add -- content
if ! git diff --cached --quiet; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -m "Archive owner growth records"
git push origin HEAD:main
fi
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: github-dist
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Report publication result on the submitted record
if: always() && github.event_name == 'issues' && github.event.action != 'deleted'
uses: actions/github-script@v7
env:
DEPLOY_OUTCOME: ${{ steps.deployment.outcome }}
with:
script: |
const fs = require('node:fs');
const number = context.issue.number;
let body;
if (process.env.DEPLOY_OUTCOME !== 'success') {
body = '这次发布未完成,线上保留上次成功版本。请查看本次运行并重试:https://github.com/' + context.repo.owner + '/' + context.repo.repo + '/actions/runs/' + context.runId;
} else {
const reports = ['gallery-report.json', 'records-report.json'].filter(p => fs.existsSync(p)).map(p => JSON.parse(fs.readFileSync(p, 'utf8')));
const error = reports.flatMap(r => r.errors || []).find(e => e.id === number);
const published = reports.some(r => (r.publishedIds || []).includes(number));
body = error ? '本记录尚未发布:' + error.message + '。请编辑原记录修正后,系统会自动重试。'
: published ? '已保存并发布到成长档案:https://hulingjun.github.io/ 。知识数据已写入仓库 content/knowledge;画作见 /art/。'
: '本记录当前未在网站展示(已关闭、改名或已被同一空间的新版本取代)。GitHub 记录及历史仍保留。';
}
await github.rest.issues.createComment({...context.repo, issue_number: number, body});
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
github-dist/
gallery-report.json
records-report.json
github-pages/public/art-data/images/
github-pages/public/records/knowledge/
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,35 @@
# hulingjun.github.io
# HJ · 个人成长记录

https://hulingjun.github.io/

- 首页:自己的知识、成长随记,以及女儿的成长足迹。
- /art/:原比例绘画作品,手机可跳转 GitHub 上传。
- /knowledge/:保留现有节点编辑器,可提交 / 打开 GitHub 知识空间。
- /learning/:保留原《关键对话》学习实验;/3d-alpha/ 不变。

## 保存方式

当前是公开 GitHub Pages 网站,无需 Google Cloud、OAuth 密钥或额外后端。
登录 GitHub **hulingjun** 账号,使用仓库的“上传绘画作品”“保存知识空间”“写一条成长记录”模板。

知识编辑器的“保存到 GitHub”捕获当前空间快照,复制 JSON 后跳转提交。自动流程校验作者身份和数据,将知识保存到 content/knowledge/*.json,随记保存到 content/journal/*.json,再发布网站。只有自动回复确认成功才代表保存完成;本地缓存仅是恢复草稿,不是云端同步。

同一空间用稳定 spaceId 识别,最新提交编号为生效版本。旧记录和 Git 历史保留。打开 GitHub 空间会创建草稿副本,不覆盖原草稿。旧浏览器中的每个本地空间需要分别提交一次。单次网页提交限制 55000 字符,更大空间请先 JSON 备份并拆分。

编辑记录会更新,关闭会从网站下架,重开会恢复。关闭最新知识快照会回退到尚未关闭的较旧快照;全部关闭才会下架空间。已提交的知识文件和 Git 历史不自动删除。

## 画作与隐私

一条作品记录一张图片:JPG/PNG/WebP/GIF(首帧),最大 10 MB。HEIC 需先转 JPG。构建阶段校验 GitHub 附件域名、每次重定向、大小、MIME 与真实图片格式,自动校正方向,生成不裁切的 WebP 展示图与缩略图,移除元数据。

**GitHub 原始附件在上传后可能立即公开,网站去除元数据不等于清理原始附件。** 上传前移除位置、裁掉姓名、学校、地址。关闭记录不删除原始附件。不要提交密钥或私人信息。

不纳入贝贝、王洁、营养师、瑜伽、普拉提相关记录;相应文字校验只是防误收录,不是完整内容审查。

## 云端构建

GitHub Actions 在 main 更新、手动触发、作者本人更改成长记录时同步和部署。外部用户的 Issue 不会触发发布,构建读取记录时另以固定 GitHub 用户 ID 校验身份。Issue 文本只作为 JSON / 文字处理,不进入 shell,不执行代码。

archive-check 校验权限、解析、URL 安全、图片尺寸和去元数据、知识文件写入与正式构建。图片工具 sharp 0.35.4 在 Actions 临时目录独立安装,不改变现有应用依赖与锁文件。

部署失败保留线上上一次成功版本。下架仍需成功部署,错误详情在 Actions 以及提交记录的自动回复中。
34 changes: 34 additions & 0 deletions app/art/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import {useEffect,useRef,useState} from "react";
import {Artwork,getJson,UPLOAD_ART} from "../shared/archive";
import ArchiveNav from "../shared/ArchiveNav";
import "../shared/archive.css";

function ArtImage({art}:{art:Artwork}) {
const [error,setError]=useState(false);
return error?<span className="art-image-error">图片暂时无法显示,请刷新重试</span>:<img src={art.thumbnail} alt={art.title} width={art.width} height={art.height} loading="lazy" decoding="async" onError={()=>setError(true)}/>;
}
export default function ArtGallery() {
const [artworks,setArtworks]=useState<Artwork[]>([]);
const [status,setStatus]=useState("loading");
const [year,setYear]=useState("all");
const [selected,setSelected]=useState<Artwork|null>(null);
const dialog=useRef<HTMLDialogElement>(null);
const [retry,setRetry]=useState(0);
useEffect(()=>{
const controller=new AbortController();setStatus("loading");
getJson<{artworks:Artwork[]}>("/art-data/manifest.json",controller.signal).then(data=>{setArtworks(data.artworks);setStatus("ready");}).catch(e=>{if(e.name!=="AbortError")setStatus("error")});
return ()=>controller.abort();
},[retry]);
useEffect(()=>{if(selected)dialog.current?.showModal();else dialog.current?.close()},[selected]);
const years=[...new Set(artworks.map(a=>a.date?.slice(0,4)).filter(Boolean))].sort().reverse();
const visible=artworks.filter(a=>year==="all"||a.date?.startsWith(year));
return <div className="archive-page"><ArchiveNav active="art"/><main className="archive-main">
<header className="archive-intro"><div><p className="a-kicker">HER GROWTH / ARTWORKS</p><h1>她眼中的世界。</h1><p>把每一次落笔,留在成长的时间里。</p></div><a className="a-button primary" href={UPLOAD_ART}>+ 上传作品</a></header>
<details className="art-help"><summary>怎样上传、修改和下架作品?</summary><ol><li>先用手机拍下画作,再点击“上传作品”,在 GitHub 登录 hulingjun 账号。</li><li>填写标题、日期,在“作品图片”中选择相册照片,勾选公开确认后提交。一次提交一幅画。</li><li>通常几分钟后会自动发布。记录下方的回复会告诉你发布结果。</li><li>编辑原记录可修改作品,关闭原记录可下架,重新打开可恢复。</li></ol><p>支持 JPG、PNG、WebP、GIF(首帧),最大 10 MB;HEIC 请先转为 JPG。作品保持原比例,不裁切。</p><p>GitHub 原始附件是公开的,请先裁掉姓名、学校、住址,并移除照片位置。网站处理版会清除元数据;下架不等于删除原始附件。</p><a href="https://github.com/hulingjun/hulingjun.github.io/issues?q=is%3Aissue+author%3Ahulingjun+%22%5B%E7%94%BB%E4%BD%9C%5D%22">管理我的作品 ↗</a></details>
<div className="archive-section-heading"><h2>绘画作品 <span className="a-kicker">{artworks.length ? String(artworks.length).padStart(2,"0") : ""}</span></h2><div className="archive-filters" aria-label="按年份查看"><button aria-pressed={year==="all"} onClick={()=>setYear("all")}>全部</button>{years.map(y=><button key={y} aria-pressed={year===y} onClick={()=>setYear(y!)}>{y}</button>)}</div></div>
{status==="loading"?<p className="archive-status" role="status">正在打开画展……</p>:status==="error"?<div className="archive-status" role="alert"><p>画展暂时无法载入,作品不会因此丢失。</p><button onClick={()=>setRetry(r=>r+1)}>重试</button></div>:visible.length?<div className="art-grid">{visible.map(art=><article className="art-card" key={art.id}><button className="art-open" aria-label={"放大查看:"+art.title} onClick={()=>setSelected(art)}><ArtImage art={art}/></button><h2>{art.title}</h2><time dateTime={art.date??undefined}>{art.date??"创作日期未记录"}</time>{art.story&&<p>{art.story}</p>}</article>)}</div>:<div className="archive-empty"><h3>{artworks.length?"这一年还没有作品":"第一幅画,从这里留下。"}</h3><p>不需要画得完美,每一幅都值得留存。</p><a className="a-button primary" href={UPLOAD_ART}>上传第一幅作品 ↗</a></div>}
<dialog className="art-dialog" ref={dialog} onClose={()=>setSelected(null)} onClick={e=>{if(e.target===e.currentTarget)setSelected(null)}} aria-labelledby="art-title">
{selected&&<><div className="art-dialog-head"><div><h2 id="art-title">{selected.title}</h2><time>{selected.date??"创作日期未记录"}</time></div><button autoFocus aria-label="关闭大图" onClick={()=>setSelected(null)}>关闭 ×</button></div><img src={selected.image} alt={selected.title} width={selected.width} height={selected.height}/>{selected.story&&<p>{selected.story}</p>}<a href={selected.sourceUrl}>查看 / 管理作品记录 ↗</a></>}
</dialog>
</main><div className="archive-foot"><span>HJ / 她的成长档案</span><a href="/">返回成长记录 ↗</a></div></div>;
}
Loading
Loading