Skip to content

Commit 8ba8185

Browse files
Redesign PythonIDE community share experience
1 parent 857c380 commit 8ba8185

8 files changed

Lines changed: 2080 additions & 335 deletions

File tree

404.html

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<meta name="theme-color" content="#f7f7f5">
7+
<meta property="og:site_name" content="Python IDE">
8+
<meta property="og:title" content="Python IDE 社区作品">
9+
<meta property="og:description" content="在 Python IDE 中查看、运行和导入社区作品。">
10+
<meta property="og:image" content="https://link.pythonide.xin/assets/app-icon.png">
611
<script>
7-
window.location.replace('/?path=' + encodeURIComponent(location.pathname + location.search + location.hash));
12+
(function () {
13+
var path = location.pathname + location.search + location.hash;
14+
location.replace('/?path=' + encodeURIComponent(path));
15+
}());
816
</script>
9-
<title>Python IDE</title>
17+
<title>Python IDE 社区作品</title>
1018
</head>
1119
<body></body>
1220
</html>

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# PythonIDE Link Site
22

3-
This directory is a zero-cost GitHub Pages site for:
3+
This directory is the static GitHub Pages origin for:
44

55
- `https://link.pythonide.xin/s/{scriptID}` community work shares
66
- `https://link.pythonide.xin/l/{code}` reserved short links
@@ -16,6 +16,14 @@ The canonical repository is
1616
Pages deploys from the default branch root with the custom domain
1717
`link.pythonide.xin` and enforced HTTPS.
1818

19+
The companion `../link-edge/` Cloudflare Worker intercepts only `/s/*` and
20+
`/og/*`. It server-renders per-script Open Graph metadata for crawlers and
21+
creates a 1200×630 PNG card from the existing public community API. All other
22+
routes, including AASA and MCP OAuth, continue to come directly from GitHub
23+
Pages. This split is required because GitHub Pages cannot generate a different
24+
HTML `<head>` for each script and WeChat does not reliably execute page
25+
JavaScript when building a link preview.
26+
1927
To publish changes, copy the contents of this `link-site/` directory to that
2028
repository root and verify the Pages deployment. The DNS record is:
2129

@@ -30,6 +38,17 @@ Do not change the root `@` or `www` records used by the main website. Do not
3038
recreate a repository named `pythonide-link` under the previous owner because
3139
that would break GitHub's repository-transfer redirects.
3240

41+
After publishing the static site, deploy `../link-edge/worker.js` with the
42+
routes declared in `../link-edge/wrangler.jsonc`. The Cloudflare zone must keep
43+
the `link` record proxied for Worker routes to run. The Worker does not replace
44+
or proxy the AASA and OAuth paths.
45+
46+
Before either deployment, run:
47+
48+
```bash
49+
node --test link-site/tests/share-page.test.js link-edge/tests/worker.test.js
50+
```
51+
3352
## iOS Requirement
3453

3554
The app entitlements must include:

assets/app-icon.png

-40 KB
Loading

assets/brand-mark.svg

Lines changed: 8 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)