chore: 清除仓库中的开发者个人信息
面向公开仓库做一次脱敏,去掉与开发者个人绑定的域名、内网入口与环境路径。 - db.php:默认数据里的个人地址全部换成通用示例(原先是开发者的私有基础设施: 带路径令牌的面板地址、若干内网服务入口,以及暴露学校身份的校内系统如教务 / BB / VPN / 财务)。 分组结构(2 个网格板块 + 3 个合集板块)与条目数量保持不变,新装仍是一份可用的示例导航。 - README.md:去掉「复刻某站风格」的表述与示例路径里的个人域名;部署步骤改为通用写法 (不再指向仓库外的私有脚本目录),并补上 Nginx 的 /data/ 拦截规则。 顺带修正一处与实际不符的描述:原文档称「页面缓存插件无需任何特殊配置」,实测该插件读不到 FastCGI 的 Cache-Control,实际是靠根 .htaccess 在请求侧注入 X_CACHE=1 才旁路掉的。 - .htaccess / config.php / functions.php / assets/css/style.css:注释里的个人域名改为通用表述。 - .gitignore:去掉开发者本机目录约定。 - LICENSE:版权署名由个人昵称改为 The SimpleNav Authors。 默认数据只在空库时写入,线上现有数据不受影响;本次无运行期行为变更。 验证:本地 php -l 全过;e2e 93/93;部署(双版本 php -l + 静态断言 + 文件哈希逐字节一致 + HTTP 冒烟 + 缓存旁路自检 + Web 身份诊断)全绿,退出码 0。
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# 部署脚本(与具体服务器、账号、路径绑定)
|
||||
# 统一放在 ~/code/_tooling/ 下,不属于应用源码,不入库
|
||||
# 不属于应用源码,按需放在仓库之外,不入库
|
||||
# ---------------------------------------------------------------------------
|
||||
/deploy/
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ Options -Indexes
|
||||
#
|
||||
# 背景(2026-09-28 线上实测):服务器装了宝塔面板的「网站加速」,那是一层基于
|
||||
# memcached 的整页缓存(脚本 /www/server/speed/httpd_speed.lua,站点配置
|
||||
# /www/server/speed/config.lua 里 n.yangyq.net 这节,expire=30 秒)。它的缓存键
|
||||
# /www/server/speed/config.lua 里该站点那一节,expire=30 秒)。它的缓存键
|
||||
# 按 host:port + 完整 URI 计算,只缓存 GET 的 text/html。
|
||||
#
|
||||
# 关键坑:它**读不到 FastCGI 后端返回的 Cache-Control**(实测存下来的副本里
|
||||
|
||||
@@ -58,7 +58,7 @@ APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
|
||||
|
||||
Copyright 2026 laoyang
|
||||
Copyright 2026 The SimpleNav Authors
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
- **合集区可「标签页折叠」或「全部平铺」**:底部「合集」区有两种展示方式,后台「设置 → 合集显示方式」一键切换。条目不多时选**全部平铺**(每个合集各占一块,一眼看全、不用点);合集多或条目杂时选**标签页折叠**(默认只展开当前那一个)。
|
||||
- **前后台永远一致**:所有动态页面都发 `Cache-Control: no-store, no-cache`,静态资源走「长缓存 + 版本号」(文件名不变、URL 带 `?v=mtime-size`)。
|
||||
|
||||
## 页面结构(复刻 n.yangyq.net 风格)
|
||||
## 页面结构
|
||||
|
||||
1. 顶部:搜索引擎切换 + 搜索框(带联想下拉)
|
||||
2. 中部:网格板块(如「常用」「工具」)——「展示方式」选「普通网格板块」的板块都在这里
|
||||
@@ -46,22 +46,30 @@ SimpleNav/
|
||||
|
||||
## 部署
|
||||
|
||||
1. 上传全部文件到站点目录(如 `/www/wwwroot/n.yangyq.net/simplenav`)。
|
||||
1. 上传全部文件到站点目录(如 `/var/www/html`,或虚拟主机常见的 `/www/wwwroot/example.com`)。
|
||||
2. 确保 web 用户对 `data/` 与 `uploads/icons/` 有写权限。
|
||||
(`data/` 不入库——它是运行时生成的 SQLite 数据库,首次部署请自行创建该目录。)
|
||||
3. 服务器需开启 PHP 的 **GD 扩展**(图标规范化要用)与 `curl`。
|
||||
4. 浏览器打开站点 → 首次访问进入「初始化管理员」,创建账号后即可在后台管理。
|
||||
5. 若服务器是 **Apache**(宝塔默认可能装 Apache 或 Nginx),`data/` 的访问拦截由仓库自带的
|
||||
`data/.htaccess` + 根目录 `.htaccess` 完成,无需改 vhost;若是 Nginx,请把
|
||||
`nginx-simplenav-deny-data.conf`(见本机 `_tooling/simplenav-deploy/`)里的规则加进 `server{}`。
|
||||
5. 阻止外部访问数据库目录:
|
||||
- **Apache**:根目录 `.htaccess` 里已含 `RewriteRule ^data/ - [F,L]`,无需改 vhost;
|
||||
- **Nginx**:在 `server{}` 里自行加一条规则:
|
||||
|
||||
服务器上创建最小权限部署账号:以 root 运行 `setup-simplenav-user.sh`(同样在 `_tooling/simplenav-deploy/`)。
|
||||
```nginx
|
||||
location ^~ /data/ { deny all; }
|
||||
```
|
||||
|
||||
> 需要额外说明的是:**服务器上若装了宝塔「网站加速」之类的页面缓存插件,本站也不需要为它做任何特殊配置**。
|
||||
> 动态页发的 `Cache-Control: ... no-cache ...` 会被这类插件视为「不缓存」而直接跳过写入。
|
||||
若用独立的低权限账号(而非 root)上传,只需保证它对该站点目录有写权限即可——
|
||||
推荐用 POSIX ACL 授权,**不要把站点文件属主改成它**。
|
||||
|
||||
> 关于页面缓存插件的坑:宝塔面板的「网站加速」(Apache + memcached 整页缓存)**读不到**
|
||||
> FastCGI 后端返回的 `Cache-Control`,会出现「后台改完、前台刷新还是旧的」。
|
||||
> 仓库自带的根目录 `.htaccess` 已在**请求侧**注入旁路标记(`Cookie: X_CACHE=1`)绕过它,
|
||||
> 无需额外配置;若你用的是别的缓存层,请确认它是否尊重后端的 `Cache-Control`。
|
||||
|
||||
## 搜索联想(建议词)说明
|
||||
|
||||
联想接口必须由**服务端代理**(浏览器直接调用会跨域)。2026-09-28 在本站服务器实测各家的可用性:
|
||||
联想接口必须由**服务端代理**(浏览器直接调用会跨域)。下面是 2026-09-28 在各家接口上实测的可用性(测试机位于中国大陆):
|
||||
|
||||
| 引擎 | 联想接口 | 实测 | 结论 |
|
||||
|---|---|---|---|
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* 简航 SimpleNav —— 前台样式
|
||||
在 n.yangyq.net「浅灰底 + 白卡片」基础上做了现代化处理:
|
||||
在经典「浅灰底 + 白卡片」导航站风格基础上做了现代化处理:
|
||||
圆角更大、阴影分层、悬停微动效、顶部品牌区与胶囊式搜索引擎切换。 */
|
||||
:root {
|
||||
--primary: #2F6BF7;
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ define('ICON_STORE', 128); // 图标统一存成 128×128
|
||||
* 是否「由 PHP 再发一颗」绕开服务器侧页面缓存的标记 cookie。
|
||||
*
|
||||
* 背景(2026-09-28 线上实测):服务器装了宝塔面板的「网站加速」,它是一层基于
|
||||
* memcached 的整页缓存,本站在其 n.yangyq.net 配置里的过期时间是 30 秒。实测它
|
||||
* memcached 的整页缓存,本站实测其过期时间是 30 秒。实测它
|
||||
* **读不到** FastCGI 后端返回的 `Cache-Control` 响应头,所以 `no-store` 之类对它
|
||||
* 无效;它唯一认的信号是**请求** cookie `X_CACHE=1`。
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* 简航 SimpleNav —— 数据库(PDO SQLite)
|
||||
* 首次访问自动建表并写入默认数据(含从 n.yangyq.net 迁移的常用/工具/合集链接)。
|
||||
* 首次访问自动建表并写入一份通用的默认数据(示例链接,可在后台随意增删)。
|
||||
*/
|
||||
declare(strict_types=1);
|
||||
|
||||
@@ -140,46 +140,46 @@ function seed_groups_and_sites(PDO $pdo): void
|
||||
// 板块定义: [名称, 类型, 排序, [ [名称, 网址], ... ] ]
|
||||
$data = [
|
||||
['常用', 'grid', 1, [
|
||||
['海大', 'http://www.ouc.edu.cn/'],
|
||||
['GitHub', 'https://github.com/'],
|
||||
['阿里云', 'https://www.aliyun.com/'],
|
||||
['知乎', 'https://www.zhihu.com/'],
|
||||
['天翼云盘', 'https://cloud.189.cn/'],
|
||||
['快科技', 'http://www.mydrivers.com/'],
|
||||
['轻舟', 'https://yangjh.net/'],
|
||||
['老杨', 'https://yangyq.net/'],
|
||||
['豆瓣', 'https://www.douban.com/'],
|
||||
['少数派', 'https://sspai.com/'],
|
||||
['红围脖', 'https://hongbowei.com/'],
|
||||
]],
|
||||
['工具', 'grid', 2, [
|
||||
['宝塔', 'https://bt.yangyq.net:8868/44d5b346'],
|
||||
['海大VPN', 'https://otrust.ouc.edu.cn'],
|
||||
['BB系统', 'https://wlkc.ouc.edu.cn/'],
|
||||
['教务系统', 'http://jwgl.ouc.edu.cn/'],
|
||||
['信息门户', 'http://my.ouc.edu.cn/'],
|
||||
['信息学部', 'http://it.ouc.edu.cn/'],
|
||||
['宝塔面板', 'https://www.bt.cn/'],
|
||||
['阿里云盘', 'https://www.alipan.com/'],
|
||||
['网易云课堂', 'https://study.163.com/'],
|
||||
['学堂在线', 'https://www.xuetangx.com/'],
|
||||
['CSDN', 'https://www.csdn.net/'],
|
||||
['稀土掘金', 'https://juejin.cn/'],
|
||||
['淘宝', 'https://www.taobao.com/'],
|
||||
['京东', 'https://www.jd.com/'],
|
||||
['日历', 'https://nas.yangyq.net/calendar'],
|
||||
['办公Nas', 'https://nas.yangyq.net/'],
|
||||
['家庭Nas', 'https://home.yangyq.net/'],
|
||||
['Git', 'https://git.yangyq.net/'],
|
||||
['网盘', 'https://nas.yangyq.net/drive/'],
|
||||
['电影', 'https://movie.yangyq.net/'],
|
||||
['相册', 'https://home.yangyq.net/photo'],
|
||||
['文件', 'https://nas.yangyq.net/file'],
|
||||
['腾讯文档', 'https://docs.qq.com/'],
|
||||
['石墨文档', 'https://shimo.im/'],
|
||||
['飞书', 'https://www.feishu.cn/'],
|
||||
['Gitee', 'https://gitee.com/'],
|
||||
['百度网盘', 'https://pan.baidu.com/'],
|
||||
['豆瓣电影', 'https://movie.douban.com/'],
|
||||
['花瓣网', 'https://huaban.com/'],
|
||||
['蓝奏云', 'https://www.lanzou.com/'],
|
||||
['bilibili', 'https://www.bilibili.com/'],
|
||||
['优酷', 'https://www.youku.com/'],
|
||||
['爱奇艺', 'https://www.iqiyi.com/'],
|
||||
['腾讯视频', 'https://v.qq.com/'],
|
||||
['芒果TV', 'https://www.mgtv.com/'],
|
||||
['Draw.IO', 'https://draw.yangyq.net'],
|
||||
['draw.io', 'https://app.diagrams.net/'],
|
||||
['稿定PS', 'https://ps.gaoding.com/'],
|
||||
['密码生成', 'https://n.yangyq.net/password/'],
|
||||
['Bitwarden', 'https://bitwarden.com/'],
|
||||
['PDF工具', 'https://pdf.wps.cn/'],
|
||||
['微信读书', 'https://weread.qq.com/'],
|
||||
['高德地图', 'https://gaode.com/'],
|
||||
['百度地图', 'https://map.baidu.com/'],
|
||||
['建设银行', 'http://ccb.com/cn/home/index.html'],
|
||||
['海大财务', 'http://hdcw.ouc.edu.cn'],
|
||||
['支付宝', 'https://www.alipay.com/'],
|
||||
['MOOC', 'https://www.icourse163.org/'],
|
||||
]],
|
||||
['常用软件', 'tabs', 10, [
|
||||
|
||||
+2
-2
@@ -311,7 +311,7 @@ function attr_value(string $tag, string $attr): string
|
||||
*
|
||||
* 为什么不能只用域名(2026-09-28 修的真实 bug):
|
||||
* 同一域名下不同路径往往是两个独立的网站条目,例如
|
||||
* https://nas.yangyq.net/calendar 与 https://nas.yangyq.net/
|
||||
* https://nas.example.com/calendar 与 https://nas.example.com/
|
||||
* 若键只取域名,两条记录会指向**同一个图标文件** —— 改其中一个的自定义图标,
|
||||
* 另一个跟着变;更糟的是保存时会 `unlink` 那个文件名,直接把对方**搞成破图**。
|
||||
*
|
||||
@@ -680,7 +680,7 @@ function icon_src(string $file): string
|
||||
*
|
||||
* ② 服务器侧页面缓存:宝塔面板的「网站加速」**Apache(mod_lua) 版**
|
||||
* (脚本 /www/server/speed/httpd_speed.lua,后端 memcached 127.0.0.1:11211,
|
||||
* 站点配置 /www/server/speed/config.lua 里 n.yangyq.net 这节,expire=30 秒)。
|
||||
* 站点配置 /www/server/speed/config.lua 里该站点那一节,expire=30 秒)。
|
||||
* 它的规则(读源码 + 线上实测):只缓存 GET + 200 + Content-Type 含 html + ≤1MB;
|
||||
* 图片/CSS/JS 等扩展名直接跳过;缓存键 = host:port + 完整 URI(含 query) + _pc|_mobile。
|
||||
* ⚠️ 它本意是「响应头 Cache-Control 含 no-cache 就不写入」,**但实测读不到
|
||||
|
||||
Reference in New Issue
Block a user