TinyImg 2.0.0:更名、下线 SM.MS、新增后台 Token 设置页

基于 ImgURL 1.x 的二次开发版本,主要变更:

1. 更名
   - 项目定名为 TinyImg,源码中不再出现旧品牌字样(0 处)
   - static/imgurl.js -> static/tinyimg.js
   - db/imgurl-simple.db3 -> db/tinyimg-simple.db3

2. 移除 SM.MS 上传
   - 删除 embed.js 中的 upload.render / smshow / deletesm
   - miniup.html 去掉 SM.MS 选项卡;前台与后台导航移除入口
   - sm.php、functions/sm.php、admin/smadmin.php 改为下线说明页
   - admin/delete.php 移除 type=sm 分支;class.admin.php 删除 querysm()/deletesm()

3. 新增后台 Token 设置(admin/setting.php + functions/token.php)
   - 生成 / 自定义 / 启用 / 停用 / 清空,全部校验 Session CSRF
   - 存储于 db/tinyimg-token.php(首行 <?php exit; 守卫)
   - config.php 的 api_token 仅作兼容回退,保存一次后由文件接管
   - 完整 Token 不写入页面 HTML:默认只渲染掩码,点「显示/复制」时
     经 POST action=reveal(同源 + CSRF + 仅登录会话)按需取回

4. 上传端点鉴权
   - 统一使用 X-TinyImg-Token 请求头,hash_equals 比较,空配置 fail closed
   - 新增 ?ping=1 自检,返回版本、鉴权方式、管理员目录,供写作插件测试连接

5. 版本号
   - 统一为 v2.0.0(20261104),前后台页脚引用 functions/version.php

6. 兼容性修复
   - class.upload.php 中 $size{...} 花括号下标改为 $size[...](PHP 8 已移除该语法)

7. 仓库整理
   - .gitignore 排除 config.php / db/tinyimg-token.php / 运行时目录,
     保留 db/.htaccess 与空模板 db/tinyimg-simple.db3
   - .gitattributes 统一 LF
This commit is contained in:
terry
2026-11-05 17:30:05 +08:00
parent 39e84a0fac
commit aac91aa9b6
180 changed files with 15976 additions and 2 deletions
+229
View File
@@ -0,0 +1,229 @@
.header{
background-color:#393D49;
width:100%;
}
.left-menu{
float: left;
padding-top:15px;
}
.left-menu a{
color:#E1E1E1;
}
.right-menu{
float: right;
}
.menu{
float: left;
}
.footer{
width:100%;
position:fixed;
left:0;
bottom:0;
background: #2F4056;
color:#E1E1E1;
padding:14px;
}
.footer a{
color:#E1E1E1;
}
.login{
margin-top:100px;
}
.login button{
width:100%;
}
#upimg{
margin-left:auto;
margin-right:auto;
margin-top:2em;
/*width:94.6%;*/
width:100%;
-moz-box-sizing: border-box; /*Firefox3.5+*/
-webkit-box-sizing: border-box; /*Safari3.2+*/
-o-box-sizing: border-box; /*Opera9.6*/
-ms-box-sizing: border-box; /*IE8*/
box-sizing: border-box;
left:0%;
background-color:#F9F9F9;
}
#upimg i{
font-size:80px;
margin-left:auto;
margin-right:auto;
}
#upimg p{
margin-bottom:20px;
}
#upok{
margin-top:4em;
display: none;
}
#showpic img{
max-width: 100%;
max-height: 100%;
border:1px solid #ECECEC;
border-radius:5px;
margin-top:1em;
margin-left:auto;
margin-right:auto;
}
#found-img{
margin-top:4em;
}
#found-img img{
max-width: 100%;
max-height:100%;
border:1px solid #ECECEC;
border-radius:5px;
margin-top:1em;
margin-left:auto;
margin-right:auto;
}
.msg{
/* width:100%; */
background-color:#f2f2f2;
line-height: 1em;
padding:12px;
margin-top:2em;
color:#009688;
}
#left-menu{
top:4em;
}
.picadmin img{
max-width: 100%;
max-height:100%;
border:1px solid #ECECEC;
border-radius:5px;
}
.page{
margin-bottom:100px;
margin-top:60px;
}
#about{
margin-top:4em;
color:#353535;
}
#about p{
margin-top:1em;
margin-bottom:1em;
}
#about h3{
font-weight: bold;
}
#about a{
color:#01AAED;
}
#about ul li{
list-style-type:disc;
line-height:1.6em;
margin-left:2em;
}
#about ul{
margin-top:1em;
margin-bottom:1em;
}
.smfile{
width:100%;
height:188px;
border: 1px dashed #e2e2e2;
margin-top:2em;
}
.smfile .file {
position: relative;
display: inline-block;
/* background: #D0EEFF; */
/* border: 1px solid #99D3F5;
border-radius: 4px;
padding: 4px 12px; */
overflow: hidden;
color: #009688;
text-decoration: none;
text-indent: 0;
line-height: 188px;
display: block;
height: 100%;
text-align: center;
margin-left:auto;
margin-right:auto;
background-color: #F9F9F9;
}
.smfile .file input {
position: absolute;
font-size: 100px;
right: 0;
top: 0;
opacity: 0;
}
.smfile .file:hover {
/* background: #AADFFD;
border-color: #78C3F3; */
color:#009688;
text-decoration: none;
}
.showimg{
display:none;
position:absolute;
max-width:460px;
top:3em;
z-index:99;
border:1px solid #e2e2e2;
border-radius:5px;
}
.layui-table img {
max-width: 460px;
}
.viewimg{
position: absolute;
display:none;
border:1px solid #F0F0F0;
border-radius:5px;
z-index:99;
top:3em;
}
.viewimg img{
max-width:660px;
}
#adminshow{
display: none;
}
#adminshow img{
max-width:680px;
text-align:center;
}
#copy{
width:680px;
margin-left:auto;
margin-right:auto;
}
.urltext{
margin-top:2em;
}
#tongji .item{
/*height:8em;*/
background-color: #F0F0F0;
/*border:1px solid #e2e2e2;*/
border-radius: 2px;
background-color: #99CCCC;
color:#FFFFFF;
text-align:center;
margin-bottom:1em;
line-height:3em;
}
#tongji .item:hover{
-webkit-box-shadow: 2px 2px 8px 1px rgba(20, 20, 20, 0.15); -moz-box-shadow: 2px 2px 8px 1px rgba(20, 20, 20, 0.15);box-shadow: 2px 2px 8px 1px rgba(20, 20, 20, 0.15);
cursor:pointer;
}
#tongji a{
color:#FFFFFF;
}