mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1aa4bb0634 | |||
| fe1244b099 | |||
| 131d0d664b | |||
| 004273c0c4 | |||
| 851ff8285c | |||
| b856c288b9 |
@@ -25,11 +25,12 @@ TwoNav 是一款开源的书签(导航)管理程序,界面简洁,安装
|
||||
- [https://github.com/tznb1/TwoNav](https://github.com/tznb1/TwoNav)
|
||||
|
||||
### 技术支持
|
||||
- QQ: 271152681
|
||||
- QQ群: 695720839
|
||||
- 技术支持QQ: 271152681
|
||||
- 授权版QQ群: 695720839
|
||||
- 免费版QQ群: 621815595
|
||||
|
||||
### 运行环境
|
||||
* PHP: 7.3 - 8.2
|
||||
* PHP: 7.3 - 8.2
|
||||
* 数据库: SQLite3 或 MySQL > 5.6.0
|
||||
|
||||
### 功能特色
|
||||
|
||||
@@ -35,15 +35,15 @@ if($db_config['type'] == 'sqlite'){
|
||||
$global_config = unserialize( get_db("global_config", "v", ["k" => "o_config"]) ); //全局配置
|
||||
$c = Get('c');
|
||||
$libs = $global_config['Libs'];
|
||||
$layui['js'] = $libs.'/Layui/v2.9.0/layui.js';
|
||||
$layui['css'] = $libs.'/Layui/v2.9.0/css/layui.css';
|
||||
$layui['js'] = $libs.'/Layui/v2.9.8/layui.js';
|
||||
$layui['css'] = $libs.'/Layui/v2.9.8/css/layui.css';
|
||||
$global_config['static_link'] = isset($global_config['static_link']) ? $global_config['static_link'] : 0;
|
||||
define('libs',$global_config['Libs']);
|
||||
define('SysVer',Get_Version());
|
||||
define('Debug',$global_config['Debug'] == 1);
|
||||
define('static_link',$global_config['static_link'] > 0);
|
||||
|
||||
if(!in_array($c,[$global_config["Register"],'ico','icon'])){
|
||||
if(!in_array($c,[$global_config["Register"],'ico','icon','auth'])){
|
||||
if($global_config['static_link'] > 0 && !empty($UUID)){
|
||||
$_GET['u'] = $global_config['static_link'] == 2 ? get_db("global_user", "User", ["ID"=>$UUID]) : $UUID;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ if(empty($c) || $c == 'index'){
|
||||
require "./system/Register.php";//注册
|
||||
}elseif($c == $global_config['Login'] || $c == $USER_DB['Login']){
|
||||
require "./system/login.php";//登陆
|
||||
}elseif(in_array($c,['admin','click','api','ico','icon','verify'])){
|
||||
}elseif(in_array($c,['admin','click','api','ico','icon','verify','auth'])){
|
||||
require "./system/{$c}.php";
|
||||
}elseif(in_array($c,['apply','guestbook','article','sitemap'])){
|
||||
if($global_config['Maintenance'] != 0){Amsg(-1,'网站正在进行维护,请稍后再试!');}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 322 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 322 KiB After Width: | Height: | Size: 322 KiB |
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5
-4
@@ -97,6 +97,7 @@ if(!empty($_GET['type'])){
|
||||
msg(-1,'密码不能为空');
|
||||
}
|
||||
$RegTime = get_db('global_user','RegTime',['ID'=>$_POST['ID']]);
|
||||
delete_db( "user_login_info", ["uid"=>$_POST['ID']] );
|
||||
update_db('global_user',['Password'=>Get_MD5_Password($_POST['new_pwd'],$RegTime)],["ID" => $_POST['ID'] ],[1,'修改成功']);
|
||||
}elseif($_GET['type'] == 'set_root'){
|
||||
update_db('global_user',['UserGroup'=>'root'],["ID" => $_POST['ID'] ],[1,'修改成功']);
|
||||
@@ -227,7 +228,7 @@ function echo_Atool(){
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.0/css/layui.css">
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.8/css/layui.css">
|
||||
<style>
|
||||
html, body {min-width: 1200px;background-color: #fff;position: relative;}
|
||||
.page-wrapper {width: 1200px;margin: 0 auto;padding: 0 15px;}
|
||||
@@ -279,7 +280,7 @@ function echo_Atool(){
|
||||
<a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="del_otp" title="移除OTP登录验证">删OTP</a>
|
||||
</div>
|
||||
</script>
|
||||
<script src="../static/Layui/v2.9.0/layui.js"></script>
|
||||
<script src="../static/Layui/v2.9.8/layui.js"></script>
|
||||
<script src="../static/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src="../static/jquery/jquery.md5.js"></script>
|
||||
<script src="../templates/admin/js/public.js?v=<?php echo time();?>"></script>
|
||||
@@ -416,7 +417,7 @@ function echo_verify(){ ?>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>ATool 工具箱</title>
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.0/css/layui.css">
|
||||
<link rel="stylesheet" href="../static/Layui/v2.9.8/css/layui.css">
|
||||
<link rel="stylesheet" href="../static/Other/login.css">
|
||||
</head>
|
||||
<body>
|
||||
@@ -441,7 +442,7 @@ function echo_verify(){ ?>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "../static/jquery/jquery-3.6.0.min.js"></script>
|
||||
<script src = "../static/Layui/v2.9.0/layui.js"></script>
|
||||
<script src = "../static/Layui/v2.9.8/layui.js"></script>
|
||||
<script src = '../static/jquery/jquery.md5.js'></script>
|
||||
<script>
|
||||
layui.use(['form','jquery'], function () {
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
// 检测是否已授权
|
||||
if(is_subscribe('bool')){
|
||||
//读取授权信息,判断是否存在秘钥
|
||||
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
|
||||
if(!isset($subscribe['public']) || empty($subscribe['public'])){
|
||||
//尝试从服务器下载秘钥
|
||||
$Res = ccurl("https://service.twonav.cn/api.php?fn=get_subscribe&order_id={$subscribe['order_id']}&email={$subscribe['email']}&domain={$subscribe['domain']}&mark=20230917",30,true);
|
||||
$data = json_decode($Res["content"], true);
|
||||
// 获取成功
|
||||
if($data["code"] == 200){
|
||||
$subscribe['public'] = $data['data']['public'];
|
||||
$subscribe['type'] = $data['data']['type'];
|
||||
$subscribe['type_name'] = $data['data']['type_name'];
|
||||
write_global_config('s_subscribe',$subscribe,'订阅信息');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,6 +49,8 @@ INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALU
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230522.php', '1684762253', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230715.php', '1689427853', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230723.php', '1690119053', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20231218.php', '1702828800', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20240328.php', '1711296000', 'TRUE', '');
|
||||
|
||||
-- 创建用户表
|
||||
DROP TABLE IF EXISTS `global_user`;
|
||||
@@ -90,6 +92,8 @@ CREATE TABLE IF NOT EXISTS `user_categorys` (
|
||||
`description` text NOT NULL DEFAULT '' COMMENT '描述',
|
||||
`font_icon` text NOT NULL COMMENT '字体图标',
|
||||
`icon` text NOT NULL DEFAULT '' COMMENT '个性图标',
|
||||
`category_type` VARCHAR(255) NOT NULL DEFAULT 'link' COMMENT '分类类型',
|
||||
`max` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '显示数量',
|
||||
`extend` text NOT NULL COMMENT '扩展',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='用户分类';
|
||||
@@ -300,3 +304,21 @@ CREATE TABLE IF NOT EXISTS `user_article_list` (
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
|
||||
-- 第三方用户表
|
||||
CREATE TABLE IF NOT EXISTS `third_party_user` (
|
||||
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`uid` int UNSIGNED NOT NULL COMMENT '用户id',
|
||||
`inlet` text NOT NULL COMMENT '入口',
|
||||
`provider` text NOT NULL COMMENT '提供商',
|
||||
`nickname` text NOT NULL COMMENT '昵称',
|
||||
`openid` text NOT NULL COMMENT '第三方用户标识',
|
||||
`access_token` text NOT NULL COMMENT '访问令牌',
|
||||
`refresh_token` text NOT NULL COMMENT '刷新令牌',
|
||||
`faceimg` text NOT NULL COMMENT '头像URL',
|
||||
`bind_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '绑定时间',
|
||||
`login_time` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '登录时间',
|
||||
`expires` int UNSIGNED NOT NULL DEFAULT 0 COMMENT '到期时间',
|
||||
`extend` text NOT NULL COMMENT '扩展',
|
||||
FOREIGN KEY (`uid`) REFERENCES `global_user` (`ID`) ON DELETE CASCADE,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
@@ -1,18 +0,0 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
// 检测是否已授权
|
||||
if(is_subscribe('bool')){
|
||||
//读取授权信息,判断是否存在秘钥
|
||||
$subscribe = unserialize(get_db('global_config','v',["k" => "s_subscribe"]));
|
||||
if(!isset($subscribe['public']) || empty($subscribe['public'])){
|
||||
//尝试从服务器下载秘钥
|
||||
$Res = ccurl("https://service.twonav.cn/api.php?fn=get_subscribe&order_id={$subscribe['order_id']}&email={$subscribe['email']}&domain={$subscribe['domain']}&mark=20230917",30,true);
|
||||
$data = json_decode($Res["content"], true);
|
||||
// 获取成功
|
||||
if($data["code"] == 200){
|
||||
$subscribe['public'] = $data['data']['public'];
|
||||
$subscribe['type'] = $data['data']['type'];
|
||||
$subscribe['type_name'] = $data['data']['type_name'];
|
||||
write_global_config('s_subscribe',$subscribe,'订阅信息');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,8 @@ INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALU
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230522.php', '1684762253', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230715.php', '1689427853', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20230723.php', '1690119053', 'TRUE', '');
|
||||
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20231218.php', '1702828800', 'TRUE', '');
|
||||
INSERT INTO "updatadb_logs" ("file_name", "update_time", "status", "extra") VALUES ('20240328.php', '1711296000', 'TRUE', '');
|
||||
|
||||
-- 创建用户表
|
||||
CREATE TABLE IF NOT EXISTS "global_user" (
|
||||
@@ -79,6 +80,8 @@ CREATE TABLE IF NOT EXISTS "user_categorys" (
|
||||
"description" TEXT(128) NOT NULL DEFAULT "",
|
||||
"font_icon" TEXT DEFAULT "",
|
||||
"icon" TEXT DEFAULT "",
|
||||
"category_type" TEXT DEFAULT "link",
|
||||
"max" text DEFAULT "",
|
||||
"extend" TEXT DEFAULT ""
|
||||
);
|
||||
|
||||
@@ -263,4 +266,22 @@ CREATE TABLE "user_article_list" (
|
||||
"cover" TEXT,
|
||||
"extend" TEXT,
|
||||
CONSTRAINT "id" UNIQUE ("id" ASC)
|
||||
);
|
||||
|
||||
-- 第三方用户表
|
||||
CREATE TABLE "third_party_user" (
|
||||
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
"uid" INTEGER NOT NULL,
|
||||
"inlet" TEXT NOT NULL DEFAULT "",
|
||||
"provider" TEXT NOT NULL DEFAULT "",
|
||||
"nickname" TEXT NOT NULL DEFAULT "",
|
||||
"openid" TEXT NOT NULL DEFAULT "",
|
||||
"access_token" TEXT NOT NULL DEFAULT "",
|
||||
"refresh_token" TEXT NOT NULL DEFAULT "",
|
||||
"faceimg" TEXT NOT NULL DEFAULT "",
|
||||
"bind_time" integer NOT NULL DEFAULT 0,
|
||||
"login_time" integer NOT NULL DEFAULT 0,
|
||||
"expires" integer NOT NULL DEFAULT 0,
|
||||
"extend" TEXT NOT NULL DEFAULT "",
|
||||
CONSTRAINT "uid" FOREIGN KEY ("uid") REFERENCES "global_user" ("ID") ON DELETE CASCADE
|
||||
);
|
||||
+21
-8
@@ -288,6 +288,7 @@ function write_category(){
|
||||
msg(-1,'操作类型错误');
|
||||
}
|
||||
|
||||
//读链接列表
|
||||
//读链接列表
|
||||
function read_link_list(){
|
||||
if($_GET['type'] == 'extend_list'){
|
||||
@@ -307,7 +308,8 @@ function read_link_list(){
|
||||
$page = empty(intval($_REQUEST['page'])) ? 1 : intval($_REQUEST['page']);
|
||||
$limit = empty(intval($_REQUEST['limit'])) ? 50 : intval($_REQUEST['limit']);
|
||||
$offset = ($page - 1) * $limit; //起始行号
|
||||
$where = ["uid"=> UID];
|
||||
$where = ["uid"=> UID,'fid[<=]'=>10000000];
|
||||
|
||||
//分类筛选
|
||||
if(!empty($fid)){
|
||||
$where['AND']['fid'] = $fid;
|
||||
@@ -317,6 +319,12 @@ function read_link_list(){
|
||||
// array_push($category,$fid);
|
||||
// $where['AND']['fid'] = $category;
|
||||
// }
|
||||
}else{
|
||||
//240405新增: 避免查找全部时将已停用分类下的链接显示出来
|
||||
$category_where = ['uid'=>UID,'fid'=>0,'status'=>1];
|
||||
$fid = select_db('user_categorys','cid', $category_where);
|
||||
$category_where['fid'] = $fid;
|
||||
$where['AND']['fid'] = array_merge ($fid,select_db('user_categorys','cid',$category_where));
|
||||
}
|
||||
//属性筛选
|
||||
if($_POST['property']==='0' || $_POST['property'] ==='1'){$where['AND']['property'] = ($_POST['property'] == 1?1:0);}
|
||||
@@ -378,7 +386,7 @@ function write_link(){
|
||||
//检测链接是否合法
|
||||
check_link($fid,$title,$url,$_POST['url_standby']);
|
||||
//检查链接是否已存在
|
||||
if(get_db('user_links','lid',['uid'=>UID ,"url" => $url])){
|
||||
if(empty(get_db('user_config','v',['uid'=>UID ,'t'=>'config','k'=>'repeat_url'])) && has_db('user_links',['uid'=>UID ,"url" => $url])){
|
||||
msg(-1,'链接已存在!');
|
||||
}
|
||||
//描述长度检测
|
||||
@@ -581,7 +589,9 @@ function write_link(){
|
||||
msg(-1,'关键字长度不能大于'.$length_limit['l_key'].'个字节');
|
||||
}
|
||||
//检查链接是否已存在
|
||||
if(has_db('user_links',['uid'=>UID ,'lid[!]'=>$lid, "url" => $url])){msg(-1,'链接已存在!');}
|
||||
if(empty(get_db('user_config','v',['uid'=>UID ,'t'=>'config','k'=>'repeat_url'])) && has_db('user_links',['uid'=>UID ,'lid[!]'=>$lid, "url" => $url])){
|
||||
msg(-1,'链接已存在!');
|
||||
}
|
||||
//检查链接ID是否存在
|
||||
if(!has_db('user_links',['uid'=>UID ,'lid'=>$lid])){msg(-1,'链接ID不存在!');}
|
||||
|
||||
@@ -812,6 +822,7 @@ function write_site_setting(){
|
||||
'link_model'=>['v'=>['direct','Privacy','Privacy_js','Privacy_meta','301','302','Transition'],'msg'=>'链接模式参数错误'],
|
||||
'main_link_priority'=>['int'=>true,'min'=>0,'max'=>3,'msg'=>'主链优先参数错误'],
|
||||
'link_icon'=>['int'=>true,'min'=>0,'max'=>30,'msg'=>'链接图标参数错误'],
|
||||
'repeat_url'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'重复链接参数错误'],
|
||||
'site_icon'=>['empty'=>true],
|
||||
'top_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'热门链接参数错误'],
|
||||
'new_link'=>['int'=>true,'min'=>0,'max'=>100,'msg'=>'最新链接参数错误'],
|
||||
@@ -837,6 +848,7 @@ function write_site_setting(){
|
||||
@unlink($site['site_icon_file']);
|
||||
$s_site['site_icon_file'] = '';
|
||||
}
|
||||
write_user_config('repeat_url',$_POST['repeat_url'],'config','重复链接');
|
||||
update_db("user_config",["v"=>$s_site],["k"=>'s_site',"uid"=>UID],[1,'保存成功']);
|
||||
}
|
||||
//写过渡页配置
|
||||
@@ -1427,7 +1439,7 @@ function read_data(){
|
||||
msg(1,'您已开启离线模式,无法使用该功能!');
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $_POST['url']);
|
||||
curl_setopt($ch, CURLOPT_URL, 'https://gitee.com/tznb/TwoNav_Resource/raw/master/connectivity_test.txt');
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
@@ -1458,8 +1470,8 @@ function read_data(){
|
||||
$php_version = floatval(PHP_VERSION);
|
||||
$log .= "PHP版本:{$php_version}\n";
|
||||
$log .= "Web版本:{$_SERVER['SERVER_SOFTWARE']}\n";
|
||||
if( ( $php_version < 7.3 ) || ( $php_version > 8.2 ) ) {
|
||||
$log .= "PHP版本:不满足要求,支持范围7.3 - 8.2 )\n";
|
||||
if( $php_version < 7.3 ) {
|
||||
$log .= "PHP版本:不满足要求,要求不低于7.3\n";
|
||||
}
|
||||
//获取加载的模块
|
||||
$ext = get_loaded_extensions();
|
||||
@@ -1506,6 +1518,8 @@ function read_data(){
|
||||
$log .= in_array("Phar",$ext) ? "" : "Phar:不支持 (在线更新/主题下载)\n";
|
||||
$log .= in_array("hash",$ext) ? "" : "hash:不支持 (书签分享/生成注册码)\n";
|
||||
$log .= in_array("session",$ext) ? "" : "session:不支持 (影响较大)\n";
|
||||
$log .= in_array("intl",$ext) ? "" : "intl:不支持 (使用中文域名时可能会导致异常)\n";
|
||||
$log .= $GLOBALS['global_config']['offline'] == '1' ? "离线模式:已开启,会导致无法更新系统/下载主题模板等\n" : "";
|
||||
$log .= "可用模块:".implode(" ",$ext)."\n";
|
||||
$updatadb_logs = select_db('updatadb_logs','file_name',['file_name[!]'=>'install.sql']);
|
||||
$log .= "数据库更新记录:".(empty($updatadb_logs)?'无':"\n".implode("\n",$updatadb_logs))."\n";
|
||||
@@ -1643,9 +1657,8 @@ function other_get_link_info(){
|
||||
msg(-1010,'URL不能为空!');
|
||||
}elseif(!preg_match("/^(http:\/\/|https:\/\/).*/",$url)){
|
||||
msg(-1010,'只支持识别http/https协议的链接!');
|
||||
}elseif( !filter_var($url, FILTER_VALIDATE_URL) ) {
|
||||
msg(-1010,'URL无效!');
|
||||
}
|
||||
$url = process_url_idn($url);
|
||||
//获取网站标题 (HTML/JS跳转无法识别)
|
||||
$c = curl_init();
|
||||
curl_setopt($c, CURLOPT_URL, $url);
|
||||
|
||||
@@ -296,7 +296,8 @@ function get_a_category(){
|
||||
//获取TwoNav信息
|
||||
function app_info(){
|
||||
$data['php_version'] = floatval(PHP_VERSION);
|
||||
$data['onenav_version'] = SysVer;
|
||||
$data['onenav_version'] = 'v0.9.35-20240318'; //模拟版本号用于解决新版插件检测版本>1提示发生异常
|
||||
$data['twonav_version'] = SysVer;
|
||||
$data['cat_num'] = count_db('user_categorys',['uid'=>UID])??0;
|
||||
$data['link_num'] = count_db('user_links',['uid'=>UID])??0;
|
||||
$data['username'] = U;
|
||||
|
||||
@@ -520,6 +520,9 @@ function other_services(){
|
||||
}else{
|
||||
$reload = true; //需要刷新
|
||||
}
|
||||
if($GLOBALS['global_config']['offline'] == '1'){
|
||||
msgA(['code'=>200,'message'=>"已开启离线模式,无法获取最新动态/官方公告/下载模板/更新系统等。"]);
|
||||
}
|
||||
// 判断是否刷新数据
|
||||
if(!$global_config['offline'] && $reload){
|
||||
if(is_subscribe('bool')){
|
||||
@@ -536,6 +539,12 @@ function other_services(){
|
||||
$data = $new_data;
|
||||
}
|
||||
}
|
||||
//时间检测
|
||||
if(isset($_GET['t']) && !empty($_GET['t'])){
|
||||
if (abs( time() - $_GET['t'] ) > 300) {
|
||||
$data['message'] .= "<br /><span style=\"color: #ff5722;\" >检测到客户端时间与服务器时间存在较大差异<br />这会导致部分功能无法正常使用<br />请及时校对服务器或客户端时间</span>";
|
||||
}
|
||||
}
|
||||
msgA($data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
// 鉴权接口: 账号登录
|
||||
|
||||
//忽略GET/POST以外的请求
|
||||
if(!in_array($_SERVER['REQUEST_METHOD'],['GET','POST'])){
|
||||
exit;
|
||||
}
|
||||
if(!isset($auth_mode)){
|
||||
$auth_mode = $_GET['mode'];
|
||||
}
|
||||
|
||||
//账号登录
|
||||
if($auth_mode == 'uname'){
|
||||
$username = $_POST['username'];
|
||||
$password = $_POST['password'];
|
||||
$log = ["uid" => '',"user"=>$username,"ip"=>Get_IP(),"time"=>time(),"type" => 'login',"content"=>Get_Request_Content(),"description"=>""];
|
||||
//密码长度
|
||||
if(strlen($password)!==32){
|
||||
$log['description'] = '请求登录>密码错误(长度应该是32位的MD5)';
|
||||
insert_db("user_log",$log);
|
||||
msg(-1,'账号或密码错误');
|
||||
}
|
||||
//浏览器UA
|
||||
if(strlen($_SERVER['HTTP_USER_AGENT']) > 1024){
|
||||
$log['description'] = '请求登录>浏览器UA长度>1024';
|
||||
insert_db("user_log",$log);
|
||||
msg(-1,"浏览器UA长度异常,请更换浏览器!");
|
||||
}
|
||||
//读取资料
|
||||
$USER_DB = get_db("global_user", "*", ["OR"=>['User'=>$username,'Email'=>$username]]);
|
||||
if(empty($USER_DB)){
|
||||
$log['description'] = '请求登录>账号不存在';
|
||||
insert_db("user_log",$log);
|
||||
msg(-1,'账号不存在');
|
||||
}
|
||||
$log['uid'] = $USER_DB['ID'];
|
||||
//登录入口
|
||||
session_start();
|
||||
if($_SESSION['login'] != $global_config["Login"] && $_SESSION['login'] != $USER_DB['Login'] ){
|
||||
$log['description'] = '请求登录>登录入口错误';
|
||||
insert_db("user_log",$log);
|
||||
msg(-1,"请求失败,请刷新登录页面再试");
|
||||
}
|
||||
//双重验证
|
||||
$LoginConfig = unserialize( $USER_DB['LoginConfig'] );
|
||||
if(!empty($LoginConfig['totp_key'])){
|
||||
if(empty($_POST['otp_code'])){
|
||||
msgA(['code'=>2]);
|
||||
}
|
||||
require DIR . '/system/Authenticator.php';
|
||||
$totp = new PHPGangsta_GoogleAuthenticator();
|
||||
$checkResult = $totp->verifyCode($LoginConfig['totp_key'], $_POST['otp_code'], 2);
|
||||
if(!$checkResult){
|
||||
$log['description'] = '请求登录>动态口令错误';
|
||||
insert_db("user_log",$log);
|
||||
msgA(['code'=>-1,'msg'=>'动态口令错误']);
|
||||
}
|
||||
}
|
||||
//验证密码
|
||||
if(Get_MD5_Password($password,$USER_DB["RegTime"]) === $USER_DB["Password"]){
|
||||
$log['description'] = '请求登录>登录成功';
|
||||
insert_db("user_log",$log);
|
||||
//保持登录
|
||||
$keep_login = isset($_POST['keep']) && $_POST['keep'] == 'on';
|
||||
if($keep_login == true){
|
||||
$LoginConfig['Session'] = ($LoginConfig['Session'] > 0 ? $LoginConfig['Session'] : 7 );
|
||||
}else{
|
||||
$LoginConfig['Session'] = 0;
|
||||
}
|
||||
$USER_DB['LoginConfig'] = serialize($LoginConfig);
|
||||
//设置Cookie
|
||||
Set_key($USER_DB);
|
||||
if(empty($LoginConfig['login_page']) || $LoginConfig['login_page'] == 'admin'){
|
||||
$url = "./?c=admin&u={$USER_DB['User']}";
|
||||
}elseif($LoginConfig['login_page'] == 'index'){
|
||||
$url = "./?c=index&u={$USER_DB['User']}";
|
||||
}else{
|
||||
$url = preg_match('/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i',$_SERVER['HTTP_USER_AGENT']) ? "./?c=index&u={$USER_DB['User']}" : "./?c=admin&u={$USER_DB['User']}";
|
||||
}
|
||||
//默认页面
|
||||
if(!empty($global_config['default_page'])){
|
||||
setcookie('Default_User', $USER_DB['User'], strtotime("+360 day"),"/",'',false,false);
|
||||
}
|
||||
msgA(['code'=>1,'msg'=>'登录成功','url'=>$url]);
|
||||
}else{
|
||||
$log['description'] = '请求登录>账户或密码错误';
|
||||
insert_db("user_log",$log);
|
||||
msg(-1,"账户或密码错误");
|
||||
}
|
||||
}
|
||||
+7
-3
@@ -86,7 +86,9 @@ if(!empty($link['url_standby']) || $site['link_model'] == 'Transition'){
|
||||
if(!empty($link['url_standby'])) {
|
||||
$link['url_standby'] = unserialize($link['url_standby']);
|
||||
//主链优先模式
|
||||
if(!empty($site['main_link_priority']) && $site['link_model'] != 'Transition'){
|
||||
if($site['main_link_priority'] == '3'){
|
||||
$site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model'];
|
||||
}elseif($site['main_link_priority'] > 0 && $site['link_model'] != 'Transition'){
|
||||
$code = get_http_code($link['url'],3,($site['main_link_priority'] == 1));
|
||||
if(in_array(intval($code),[200,301,302,401]) ){
|
||||
$site['link_model'] = $site['link_model'] == 'direct' ? '302' : $site['link_model'];
|
||||
@@ -110,9 +112,11 @@ if ($site['link_model'] == '302'){ //302重定向(临时)
|
||||
exit;
|
||||
}elseif($site['link_model'] == 'Privacy'){ //隐私保护_header
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
if(preg_match('/[\x{4e00}-\x{9fa5}]/u', $link['url']) > 0){
|
||||
exit ('<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><script>window.location.href="'.$link['url'].'"</script></head>');
|
||||
}
|
||||
header("Refresh:0;url=".$link['url']);
|
||||
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"></head>';
|
||||
exit;
|
||||
exit ('<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"></head>');
|
||||
}elseif($site['link_model'] == 'Privacy_js'){ //隐私保护_js
|
||||
header("Content-type: text/html; charset=utf-8");
|
||||
echo '<html lang="zh-ch"><head><title>正在保护您的隐私..</title><meta name="referrer" content="same-origin"><script>window.location.href="'.$link['url'].'"</script></head>';
|
||||
|
||||
+10
-9
@@ -4,8 +4,8 @@ if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Fou
|
||||
//初始化
|
||||
session_name('TwoNav_initial');
|
||||
session_start();
|
||||
$layui['js'] = './static/Layui/v2.9.0/layui.js';
|
||||
$layui['css'] = './static/Layui/v2.9.0/css/layui.css';
|
||||
$layui['js'] = './static/Layui/v2.9.8/layui.js';
|
||||
$layui['css'] = './static/Layui/v2.9.8/css/layui.css';
|
||||
|
||||
//判断请求类型
|
||||
if($_SERVER['REQUEST_METHOD'] === 'POST'){
|
||||
@@ -33,8 +33,8 @@ function check_env() {
|
||||
$ext = get_loaded_extensions(); //获取组件信息
|
||||
$php_version = floatval(PHP_VERSION); //获取PHP版本
|
||||
|
||||
if( ( $php_version < 7.3 ) || ( $php_version > 8.2 ) ) {
|
||||
exit("当前PHP版本{$php_version}不满足要求,支持范围7.3 - 8.2");
|
||||
if($php_version < 7.3 ) {
|
||||
exit("当前PHP版本{$php_version}不满足要求,要求不低于7.3");
|
||||
}
|
||||
|
||||
//检查是否支持pdo_sqlite
|
||||
@@ -59,8 +59,8 @@ function diagnosis() {
|
||||
$php_version = floatval(PHP_VERSION);
|
||||
$log .= "PHP版本:{$php_version}<br />";
|
||||
$log .= "Web版本:{$_SERVER['SERVER_SOFTWARE']}<br />";
|
||||
if( ( $php_version < 7.3 ) || ( $php_version > 8.1 ) ) {
|
||||
$log .= "PHP版本:不满足要求,需要7.3 <= PHP <= 8.1 )<br />";
|
||||
if( $php_version < 7.3) {
|
||||
$log .= "PHP版本:不满足要求,要求不低于7.3<br />";
|
||||
}
|
||||
//获取加载的模块
|
||||
$ext = get_loaded_extensions();
|
||||
@@ -85,6 +85,7 @@ function diagnosis() {
|
||||
$log .= in_array("Phar",$ext) ? "Phar:支持<br />" : "Phar:不支持 (在线更新/主题下载)<br />";
|
||||
$log .= in_array("hash",$ext) ? "hash:支持<br />" : "hash:不支持 (书签分享/生成注册码)<br />";
|
||||
$log .= in_array("session",$ext) ? "session:支持<br />" : "session:不支持 (影响较大)<br />";
|
||||
$log .= in_array("intl",$ext) ? "" : "intl:不支持 (使用中文域名时可能会导致异常)\n";
|
||||
$log .= "可用模块:".implode(" ",$ext)."<br />";
|
||||
exit($log);
|
||||
}
|
||||
@@ -312,10 +313,10 @@ function Write_Config(){
|
||||
$o_config['global_header'] = '';
|
||||
$o_config['global_footer'] = '';
|
||||
$o_config['api_extend'] = 0;
|
||||
$o_config['apply'] = 0;
|
||||
$o_config['guestbook'] = 0;
|
||||
$o_config['apply'] = 1;
|
||||
$o_config['guestbook'] = 1;
|
||||
$o_config['link_extend'] = 0;
|
||||
$o_config['article'] = 0;
|
||||
$o_config['article'] = 1;
|
||||
$o_config['c_name'] = 0;
|
||||
$o_config['c_desc'] = 0;
|
||||
$o_config['l_name'] = 0;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
//如果是Get请求则载入登录模板
|
||||
if($_SERVER['REQUEST_METHOD'] === 'GET'){
|
||||
session_start();
|
||||
$_SESSION['login'] = $c;
|
||||
require DIR."/system/templates.php";
|
||||
require $index_path;
|
||||
exit;
|
||||
|
||||
+21
-3
@@ -291,8 +291,9 @@ function Set_key($USER_DB){
|
||||
$LoginConfig = unserialize($USER_DB['LoginConfig']);
|
||||
$session = $LoginConfig['Session']; //保持时间(单位天)
|
||||
$Expire = Get_ExpireTime($session); //计算到期时间戳
|
||||
$real_Expire = ($Expire == 0) ? time() + 86400 : $Expire;
|
||||
$time = time(); //取当前时间
|
||||
$key = Getkey($USER_DB['User'],Get_MD5_Password($USER_DB["Password"],$USER_DB["RegTime"]),$Expire,$LoginConfig['KeySecurity'],$time);
|
||||
$key = Getkey($USER_DB['User'],Get_MD5_Password($USER_DB["Password"],$USER_DB["RegTime"]),$real_Expire,$LoginConfig['KeySecurity'],$time);
|
||||
setcookie($USER_DB['User'].'_key', $key, $session == 0 ? 0 : $Expire,"/",'',false,$LoginConfig['HttpOnly']==1);
|
||||
insert_db("user_login_info", [
|
||||
"uid" => $USER_DB['ID'],
|
||||
@@ -301,8 +302,8 @@ function Set_key($USER_DB){
|
||||
"ua"=>$_SERVER['HTTP_USER_AGENT'],
|
||||
"login_time"=>$time,
|
||||
"last_time"=>$time,
|
||||
"expire_time"=>$Expire,
|
||||
"cookie_key"=>md5($key)]); //不记录用户真实key,同时防止Cookie攻击
|
||||
"expire_time"=>$real_Expire,
|
||||
"cookie_key"=>md5($key)]);
|
||||
return $key;
|
||||
}
|
||||
|
||||
@@ -520,6 +521,9 @@ function Get_IP() {
|
||||
|
||||
//获取URL状态码
|
||||
function get_http_code($url,$TIMEOUT = 10 ,$NOBODY = true) {
|
||||
if(!preg_match("/^(http:\/\/|https:\/\/).*/",$url)){
|
||||
return false;
|
||||
}
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
curl_setopt($curl, CURLOPT_HEADER, 1);
|
||||
@@ -534,6 +538,9 @@ function get_http_code($url,$TIMEOUT = 10 ,$NOBODY = true) {
|
||||
}
|
||||
|
||||
function ccurl($url,$overtime = 3,$Referer = false,$post_data = false){
|
||||
if(!preg_match("/^(http:\/\/|https:\/\/).*/",$url)){
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
$curl = curl_init ( $url ) ; //初始化
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, $overtime ); //超时
|
||||
@@ -564,6 +571,9 @@ function ccurl($url,$overtime = 3,$Referer = false,$post_data = false){
|
||||
}
|
||||
|
||||
function downFile($url, $file = '', $savePath = './data/temp/',$referer = '',$TIMEOUT = 60,$post_data = false){
|
||||
if(!preg_match("/^(http:\/\/|https:\/\/).*/",$url)){
|
||||
return false;
|
||||
}
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, $TIMEOUT); //超时/秒
|
||||
@@ -774,4 +784,12 @@ function get_OEM(){
|
||||
//返回404
|
||||
function Not_Found() {
|
||||
header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;
|
||||
}
|
||||
|
||||
function process_url_idn($url) {
|
||||
$parsed_url = parse_url($url);
|
||||
if(!preg_match('/[\x{4e00}-\x{9fa5}]/u', $parsed_url['host'])){
|
||||
return $url;
|
||||
}
|
||||
return substr_replace($url, idn_to_ascii($parsed_url['host']), strpos($url, "//") + 2, strlen($parsed_url['host']));
|
||||
}
|
||||
+1
-1
@@ -1 +1 @@
|
||||
v2.1.07-20231130
|
||||
v2.1.14-20240414
|
||||
@@ -8,7 +8,7 @@ layui.use(['layer','miniTab'], function(){
|
||||
|
||||
|
||||
// 获取最新信息
|
||||
$.post(get_api('other_services','get_notice'),function(data,status){
|
||||
$.post(get_api('other_services','get_notice') + '&t=' + Math.round(new Date() / 1000),function(data,status){
|
||||
if(data.code == 200) {
|
||||
$("#new_ver a").text(data.version);
|
||||
$('#notice_link').text('');
|
||||
@@ -40,7 +40,7 @@ layui.use(['layer','miniTab'], function(){
|
||||
//获取当前版本
|
||||
let current_version = $("#ver").text();
|
||||
|
||||
let pattern = /\d{8}/;
|
||||
let pattern = /v(\d+\.\d+\.\d+)/;
|
||||
current_version = pattern.exec(current_version)[0];
|
||||
latest_version = pattern.exec(latest_version)[0];
|
||||
|
||||
|
||||
@@ -15,6 +15,5 @@ layui.config({
|
||||
treetable: 'treetable-lay/treetable', //table树形扩展
|
||||
tableSelect: 'tableSelect/tableSelect', // table选择扩展
|
||||
xIcon: 'xIcon/xIcon', //图标选择器
|
||||
treeSelect: 'treeSelect/treeSelect', // 树形下拉选择器
|
||||
background: 'background/background' //随机背景图
|
||||
treeSelect: 'treeSelect/treeSelect'
|
||||
});
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/**
|
||||
* 随机背景图
|
||||
*/
|
||||
layui.define(['dropdown'], function (exports) {
|
||||
var background = {
|
||||
render: function (elem) {
|
||||
layui.dropdown.render({elem: elem
|
||||
,data: [{
|
||||
title: '博天(自适应/动漫)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=dongman&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/妹子)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=meizi&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/风景)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=fengjing&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '博天(自适应/随机)'
|
||||
,url: 'https://api.btstu.cn/sjbz/api.php?lx=suiji&method=zsy'
|
||||
,author:'https://api.btstu.cn/doc/sjbz.php'
|
||||
},{
|
||||
title: '姬长信(PC/每日必应)'
|
||||
,url: 'https://api.isoyu.com/bing_images.php'
|
||||
,author:'https://api.isoyu.com'
|
||||
},{
|
||||
title: '樱花(PC/动漫)'
|
||||
,url: 'https://www.dmoe.cc/random.php'
|
||||
,author:'https://www.dmoe.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/动漫)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=dongman&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/风景)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=fengjing&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/必应)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=biying&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '梁炯灿(PC/美女)'
|
||||
,url: 'https://tuapi.eees.cc/api.php?category=meinv&type=302'
|
||||
,author:'https://tuapi.eees.cc'
|
||||
},{
|
||||
title: '苏晓晴(PC/动漫)'
|
||||
,url: 'https://acg.toubiec.cn/random.php'
|
||||
,author:'https://acg.toubiec.cn'
|
||||
},{
|
||||
title: '墨天逸(PC/动漫)'
|
||||
,url: 'https://api.mtyqx.cn/api/random.php'
|
||||
,author:'https://api.mtyqx.cn/'
|
||||
},{
|
||||
title: '小歪(PC/动漫)'
|
||||
,url: 'https://api.ixiaowai.cn/api/api.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '小歪(PC/MC酱)'
|
||||
,url: 'https://api.ixiaowai.cn/mcapi/mcapi.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '小歪(PC/风景)'
|
||||
,url: 'https://api.ixiaowai.cn/gqapi/gqapi.php'
|
||||
,author:'https://api.ixiaowai.cn'
|
||||
},{
|
||||
title: '保罗(PC/动漫)'
|
||||
,url: 'https://api.paugram.com/wallpaper/?source=sina'
|
||||
,author:'https://api.paugram.com/help/wallpaper'
|
||||
},{
|
||||
title: '樱道(PC/动漫)'
|
||||
,url: 'https://api.r10086.com/img-api.php?type=动漫综合1'
|
||||
,author:'https://img.r10086.com/'
|
||||
}],click: function(obj){
|
||||
this.elem.val(obj.url);
|
||||
},style: 'width: 235px;'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
exports("background",background);
|
||||
});
|
||||
@@ -474,6 +474,7 @@ layui.use(['form','table','dropdown','miniTab'], function () {
|
||||
//手机端操作
|
||||
function load_dropdown(){
|
||||
var data = [];
|
||||
data.push({'title':'删除选中','id':'batch_del'});
|
||||
$(".layui-btn-normal.layui-hide-xs").each(function(){
|
||||
data.push({'title':$(this).text(),'id':$(this).attr('lay-event')});
|
||||
});
|
||||
|
||||
@@ -73,17 +73,21 @@
|
||||
<option value="20" >本地服务</option>
|
||||
<option value="21" >本地服务(伪静态)</option>
|
||||
<option value="2" >favicon.png.pub (小图标)</option>
|
||||
<!--<option value="4" >api.15777.cn</option>-->
|
||||
<!--<option value="5" >favicon.cccyun.cc</option>-->
|
||||
<option value="6" >api.iowen.cn</option>
|
||||
<!--<option value="7" >toolb.cn</option>-->
|
||||
<!--<option value="8" >apis.jxcxin.cn</option>-->
|
||||
<!--<option value="9" >ico.kucat.cn</option>-->
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">所有API接口均由其他大佬提供!若有异常请尝试更换接口!</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">重复链接</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="repeat_url" >
|
||||
<option value="0" selected>禁止</option>
|
||||
<option value="1">允许</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">是否允许添加已存在的链接</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">最新网址</label>
|
||||
<div class="layui-input-inline" >
|
||||
|
||||
@@ -22,12 +22,14 @@
|
||||
<div class="layui-colla-item">
|
||||
<div class="layui-colla-title">如何使用Chrome浏览器扩展 [非官方]</div>
|
||||
<div class="layui-colla-content">
|
||||
前言: 由于浏览器扩展插件非TwoNav所开发适配,如存在Bug或无法使用属正常现象!<br />
|
||||
安装: 谷歌应用商店下载<a href="https://chrome.google.com/webstore/detail/onenav/omlkjgkogkfpjbdigianpdbjncdchdco?hl=zh-CN&authuser=0" >OneNav</a>并安装 ( 已知0.9.24 - 1.0.1可用,其他版本未知 )<br />
|
||||
设置S: 1.TwoNav后台>右上角账号>安全设置>API模式>设为<兼容模式> 2.在本页面获取Token<br />
|
||||
设置C: 插件API设置>填入域名和Token并保存>完成<br />
|
||||
问题1: 对于单用户使用,确保系统设置中默认用户是当前用户即可!多用户使用时需开启二级域名功能并将域名替换成用户的二级域名,注意结尾不需要带/
|
||||
问题2: 因为插件非官方开发维护,能用就尽量不要更新,如果插件更新可能会导致无法正常使用,需这个更新获得兼容性!
|
||||
注意事项: 由于浏览器扩展插件非TwoNav所开发适配,如存在Bug或无法使用属正常现象!<br />
|
||||
安装扩展: 扩展插件获取:
|
||||
<a style="color:#3c78d8" href="https://chromewebstore.google.com/detail/onenav/omlkjgkogkfpjbdigianpdbjncdchdco" >Chrome/Edge</a> /
|
||||
<a style="color:#3c78d8" href="https://addons.mozilla.org/zh-CN/firefox/addon/onenav" >Firefox</a> 下载并安装 ( 已知0.9.24 - 1.1.0可用,其他版本未知 )<br />
|
||||
后台设置: 1.TwoNav后台>右上角账号>安全设置>API模式>设为<兼容模式> 2.在本页面获取Token<br />
|
||||
扩展设置: 设置>填入域名和Token并保存即可,注意: 扩展插件中的推荐内容与本程序无关<br />
|
||||
问题1: 对于单用户使用,确保系统设置中默认用户是当前用户即可!多用户使用时需开启二级域名功能并将域名替换成用户的二级域名,注意结尾不需要带/<br />
|
||||
问题2: 因为插件非官方开发维护,能用就尽量不要更新,更新后可能会导致无法正常使用!如有发现不兼容我们也会尽快跟进!<br />
|
||||
问题3: 因为国内环境限制,你可能无法访问谷歌,这种情况你可以在交流群获取插件(安装方法自行百度,部分浏览器可能需要开发者模式加载)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -240,7 +240,7 @@ require 'header.php';
|
||||
<?php }?>
|
||||
<tr>
|
||||
<td>用户交流</td>
|
||||
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=LaIzFK2hfTYBZGR0cKvW3xZL6aNgcSXH&jump_from=webapi&authKey=LHh1NtAiGdK0wNyoZiHWrzAZTWWq26YgAwX0Ak7rBWchh6Y5ocUX/0cCXLMXvq/k" title="TwoNav - 技术交流">QQ群:695720839</a>
|
||||
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=dMXOVXaYcnKMVmPsqBqpeSxcszy-z4vT&jump_from=webapi&authKey=SQArXAovtNKkH4VGv2Uy6p9wITMQxtjx8W2xLxCKkw3IOwXqQ9H34k4K9o1p4DVQ" title="TwoNav - 技术交流2">QQ群:621815595</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -4,6 +4,15 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
?>
|
||||
<style>
|
||||
.layui-btn-container .layui-btn{border-width: 1px; border-style: solid; border-color: #FF5722!important; color: #FF5722!important;background: none;height: 30px; line-height: 30px; padding: 0 10px; font-size: 12px;}
|
||||
.footer{
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #e6e6e6;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
@@ -331,8 +340,8 @@ $title='系统设置';require(dirname(__DIR__).'/header.php');
|
||||
<div class="layui-form-mid layui-word-aux">是否允许默认用户组使用自定义代码!允许存在安全隐患!</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block"><button class="layui-btn layui-btn-normal" lay-submit lay-filter="save">确认保存</button></div>
|
||||
<div class="footer">
|
||||
<button class="layui-btn layui-btn-normal" lay-submit lay-filter="save" style=" margin-left: 10px; ">确认保存</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -88,27 +88,18 @@ layui.use(['layer','form','miniTab'], function () {
|
||||
$("#console_log").text("");
|
||||
$("#console_log").append("浏览器UA:" + navigator.userAgent +"\n");
|
||||
$("#console_log").append("客户端时间:" + timestampToTime(Math.round(new Date() / 1000) ) +"\n");
|
||||
|
||||
var urls = [
|
||||
['资源节点-码云', 'https://gitee.com/tznb/TwoNav_Resource/raw/master/connectivity_test.txt']
|
||||
];
|
||||
urls.forEach(function(route) {
|
||||
var routeName = route[0];
|
||||
var url = route[1];
|
||||
$("#console_log").append("正在检测: " + routeName +"\n");
|
||||
$.ajax({
|
||||
url: get_api('read_data', 'connectivity_test'),
|
||||
type: 'POST',
|
||||
data: { url: url },
|
||||
//async: false,
|
||||
success: function(data, status) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(data.msg + "\n");
|
||||
},error: function(jqXHR, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(routeName + ": 请求 " + url + " 发生错误:" + errorThrown + "\n");
|
||||
}
|
||||
});
|
||||
$("#console_log").append("正在检测: " + 'gitee' +"\n");
|
||||
$.ajax({
|
||||
url: get_api('read_data', 'connectivity_test'),
|
||||
type: 'POST',
|
||||
data: { id: '1' },
|
||||
success: function(data, status) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(data.msg + "\n");
|
||||
},error: function(jqXHR, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append('gitee' + ": 请求 " + url + " 发生错误:" + errorThrown + "\n");
|
||||
}
|
||||
});
|
||||
});
|
||||
//phpinfo
|
||||
|
||||
@@ -20,6 +20,16 @@ if(!empty($Notice)){
|
||||
<li>3. 更新成功后就是授权版的系统了,可使用全部功能</li>
|
||||
<li>4. 禁止传播/破解授权版源代码,违者封授权并追责</li>
|
||||
</blockquote>
|
||||
<blockquote class="layui-elem-quote layui-text" style="color:red" >
|
||||
<li> 温馨提示: </li>
|
||||
<li>授权是跟当前访问的域名或IP绑定的,通常建议绑定域名</li>
|
||||
<li>初次保存授权时会自动激活卡密并绑定当前域名或IP</li>
|
||||
<li>请不要在临时域名或临时IP中激活授权 (特殊情况请提前说明)</li>
|
||||
<li>授权针对顶级域名授权,如授权www.nav.cn时,dh.nav.cn可以正常使用</li>
|
||||
<li>绑定IP时部分功能会无法使用,如二级域名功能</li>
|
||||
<li>激活后修改域名或IP需扣除修改次数(年授权需付费修改)</li>
|
||||
<li>如有疑问请联系技术支持QQ: 271152681</li>
|
||||
</blockquote>
|
||||
<h3 style = "margin-bottom:1em;">当前域名:<font color="red"><?php echo $HTTP_HOST; ?></font></h3>
|
||||
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -5,18 +5,81 @@
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.07-20231130</h4>
|
||||
<h4 class="layui-timeline-title">v2.1.14-20240414</h4>
|
||||
<ul>
|
||||
<li>[升级] Layui组件由2.8.17升级到2.9.0</li>
|
||||
<li>[新增] 系统设置>限制相关>文章图片大小自定义,单位KB</li>
|
||||
<li>[变更] 文章编辑器上传图片大小限制由5M改为默认不限制,如需限制请到系统设置中自定义</li>
|
||||
<li>[变更] 文章编辑器单次上传图片数量由10改为100</li>
|
||||
<li>[模板] WebStack-Hugo > 处于站内搜索时搜索图标可以被点击跳转的问题/新增页内标题自定义/公告信息</li>
|
||||
<li>[模板] 新增主页模板:liuyike233 (简约型)</li>
|
||||
<li>[模板] Snavigation在底部添加管理入口</li>
|
||||
<li>[修复] 访问限制跳转到引导页时登录/注册连接错误的bug</li>
|
||||
<li>[修复] 引导页未正确读取默认站点标题的bug</li>
|
||||
<li>[变更] 部分环境获取请求IP遇到多个IP地址仅取首个</li>
|
||||
<li>[修复] 修复已知的安全漏洞提高安全性</li>
|
||||
<li>[修复] 分类停用时链接列表查找全部时出现已停用分类下的链接</li>
|
||||
<li>[升级] Layui组件由2.9.7升级到2.9.8</li>
|
||||
<li>[优化] Docker镜像支持在线下载安装包</li>
|
||||
<li>[移除] 和风天气插件 ( 因官方停止服务 )</li>
|
||||
<li>[移除] 随机背景图URL ( 大多数已经无法正常使用了 )</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.13-20240321</h4>
|
||||
<ul>
|
||||
<li>[优化] 兼容OneNav浏览器扩展V1.1.0重构版</li>
|
||||
<li>[优化] 浏览器插件的相关使用说明 ( 右上角账号>安全设置>获取API )</li>
|
||||
<li>[优化] 更新检测逻辑由原来判断日期改成判断版本号</li>
|
||||
<li>[优化] 支持PHP8.3环境下运行</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.12-20240308</h4>
|
||||
<ul>
|
||||
<li>[优化] 后台概要页支持时间差异较大提示,避免因时间错误导致的各种问题</li>
|
||||
<li>[新增] 站点设置新增重复链接选项,解决部分用户需要添加相同链接的问题</li>
|
||||
<li>[升级] Layui组件由2.9.2升级到2.9.7</li>
|
||||
<li>[变更] 默认配置调整,概要页QQ群改为免费用户群(授权用户可凭授权加入会员群)</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.11-20240119</h4>
|
||||
<ul>
|
||||
<li>[修复] 链接识别遇到中文域名时提示URL无效</li>
|
||||
<li>[修复] 链接模式为隐私保护(header)时中文域名无法跳转</li>
|
||||
<li>[修复] 主链优先设为强制优先时不起作用</li>
|
||||
<li>[优化] 一键诊断缺少intl扩展模块时给出提醒</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.09-20231220</h4>
|
||||
<ul>
|
||||
<li>[修复] 紧急修复一个影响登录的bug,影响范围:v2.1.08版本 + MySQL数据库</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<li class="layui-timeline-item">
|
||||
<i class="layui-icon layui-timeline-axis"></i>
|
||||
<div class="layui-timeline-content layui-text">
|
||||
<h4 class="layui-timeline-title">v2.1.08-20231219</h4>
|
||||
<ul>
|
||||
<li>[升级] Layui组件由2.9.0升级到2.9.2</li>
|
||||
<li>[修复] Atool工具和用户管理中强制修改用户密码时未将已登录的终端踢下线的bug</li>
|
||||
<li>[优化] 概要页面更新内容直接从服务器获取并显示,不需要在跳转到Gitee上查看</li>
|
||||
<li>[优化] 主题管理:可更新时在右上显示一个问号,点击可以查看更新内容</li>
|
||||
<li>[变更] 普通账号不在支持自定义登录模板,只有站长号可以选择和配置模板</li>
|
||||
<li>[优化] 系统设置的保存按钮改为悬浮在页面底部,避免老是要滚动到底部去点保存的问题</li>
|
||||
<li>[修复] 链接列表手机端不显示删除按钮的问题</li>
|
||||
<li>[修复] 书签分享特定条件下存在的bug</li>
|
||||
<li>[修复] 安全设置>登录保持设为浏览器关闭会导致无法登录的bug</li>
|
||||
<li>[修复] OTP双重认证使用公用登录入口时无法输入验证码的问题 ( 需更新登录模板 )</li>
|
||||
<li>[模板] [12.02]爱导航V1: 配置选项新增分类收缩,可选仅图标/分类/菜单/目录,用于解决部分手机端用户不知道点这个图标展开分类的问题</li>
|
||||
<li>[模板] [12.02]百素New: 新增拖拽排序功能、修复未加载用户header和全局header的bug、新增搜索框背景自定义支持</li>
|
||||
<li>[模板] [12.20]花森主页: 调整本地添加链接时判断是否为URL的条件,仅检测http(s)://开头</li>
|
||||
<li>[修复] [12.20]WebStack-Hugo: 夜间模式下搜索框热词点空白处没有取消热词显示的问题</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">配色</li>
|
||||
<li>设置</li>
|
||||
<li>天气</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<!--配色Tab-->
|
||||
@@ -217,57 +216,6 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<!--天气Tab-->
|
||||
<div class="layui-tab-item">
|
||||
<div class="layui-form-item">
|
||||
<input id="WeatherPosition-input" type="hidden" value="<?php echo $theme_config['WeatherPosition'];?>">
|
||||
<label class="layui-form-label">插件位置</label>
|
||||
<div class="layui-input-inline">
|
||||
<select lay-verify="required" id="WeatherPosition" name="WeatherPosition" lay-search>
|
||||
<option value="0">关闭</option>
|
||||
<option value="1">头部工具条</option>
|
||||
<option value="2">正文右上角</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">插件显示的位置</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<input id="WeatherBackground-input" type="hidden" value="<?php echo $theme_config['WeatherBackground'];?>">
|
||||
<label class="layui-form-label">天气背景</label>
|
||||
<div class="layui-input-inline">
|
||||
<select lay-verify="required" id="WeatherBackground" name="WeatherBackground" lay-search>
|
||||
<option value="1">随天气变化</option>
|
||||
<option value="2">浅色</option>
|
||||
<option value="3">深色</option>
|
||||
<option value="4">透明</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">天气插件的背景颜色</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<input id="WeatherFontColor-input" type="hidden" value="<?php echo $theme_config['WeatherFontColor'];?>">
|
||||
<label class="layui-form-label">天气字体色</label>
|
||||
<div class="layui-input-inline">
|
||||
<select lay-verify="required" id="WeatherFontColor" name="WeatherFontColor" lay-search>
|
||||
<option value="1">随头部字体色</option>
|
||||
<option value="2">随标题字体色</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">天气插件的字体颜色</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">插件Key</label>
|
||||
<div class="layui-input-inline" style="width: 50%;">
|
||||
<input type="url" id="WeatherKey" name="WeatherKey" value="<?php echo $theme_config['WeatherKey'];?>" placeholder="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<a target="_blank" style="color:#03a9f4!important;" href='https://widget.qweather.com/create-simple/'>申请Key</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="layui-form-item" style="padding-top: 10px;">
|
||||
<div class="layui-input-block">
|
||||
@@ -288,7 +236,7 @@ var u = '<?php echo $u?>';
|
||||
var t = '<?php echo $theme;?>';
|
||||
var s = '<?php echo $_GET['source'];?>';
|
||||
var api = get_api('write_theme','config') + '&t=' + t;
|
||||
layui.use(['form','colorpicker','element','dropdown','background'], function(){
|
||||
layui.use(['form','colorpicker','element','dropdown'], function(){
|
||||
var form = layui.form;
|
||||
var colorpicker = layui.colorpicker;
|
||||
var dropdown = layui.dropdown;
|
||||
@@ -327,9 +275,7 @@ dropdown.render({elem: '#CardBackgroundColor-input',data:BackgroundColor ,click:
|
||||
dropdown.render({elem: '#OtherBackgroundColor-input',data:BackgroundColor ,click: function(obj){this.elem.val(obj.code);},style: 'width: 225px;'});
|
||||
dropdown.render({elem: '#SidebarBackgroundColor-input',data:BackgroundColor ,click: function(obj){this.elem.val(obj.code);},style: 'width: 225px;'});
|
||||
|
||||
//背景图下拉菜单
|
||||
layui.background.render("input[name='backgroundURL']");
|
||||
|
||||
|
||||
function layeropen(content,url){
|
||||
layer.open({
|
||||
type: 1
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
$night = $theme_config['night'] == 1 || ( $theme_config['night'] == 2 && (date('G') <= 12 || date('G') >= 19 )) ? 'mdui-theme-layout-dark':'';
|
||||
$background = $theme_config['backgroundURL'];
|
||||
$DescrRowNumber = intval($theme_config['DescrRowNumber']);
|
||||
$WeatherKey = $theme_config['WeatherKey'];
|
||||
$WeatherPosition = intval(empty($WeatherKey)?"0":$theme_config['WeatherPosition']);
|
||||
$referrer = $theme_config['referrer'];
|
||||
$protectA = (($referrer == 'link' || $referrer == 'link_icon') && $site['link_model'] == 'direct') ? 'referrerpolicy="same-origin"':'';
|
||||
$protectIMG = ($referrer == 'link_icon' || $referrer == 'icon' ) ? 'referrerpolicy="same-origin"':'';
|
||||
@@ -83,7 +81,6 @@ body{
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if($WeatherPosition==1){ echo '<div id="he-plugin-simple"></div>';} ?>
|
||||
<a class = "mdui-hidden-xs mdui-btn mdui-btn-icon" id="config" title = "主题设置" <?php if(!is_login) {echo 'style="display:none;"';}?>><i class="mdui-icon material-icons HFC"></i></a>
|
||||
<!-- 新版搜索框END -->
|
||||
</div>
|
||||
@@ -163,7 +160,6 @@ body{
|
||||
<!--左侧抽屉导航END-->
|
||||
<!--正文内容部分-->
|
||||
<div class="mdui-container">
|
||||
<?php if($WeatherPosition==2){ echo '<div style="position:fixed;z-index:1000;right:0px;width:160px;padding-right:0px;"><div id="he-plugin-simple"></div></div>'."\n";} ?>
|
||||
<div class="mdui-row">
|
||||
<!-- 遍历分类目录 -->
|
||||
<?php foreach ( $categorys as $category ) {
|
||||
@@ -240,41 +236,5 @@ var is_login = <?php echo is_login?'true':'false'; ?>;
|
||||
<script src = "<?php echo $libs?>/Other/holmes.js"></script>
|
||||
<script src = "<?php echo $libs; ?>/jquery/jquery.qrcode.min.js"></script>
|
||||
<script src = "<?php echo $theme_dir?>/static/embed.js?v=<?php echo $theme_ver;?>"></script>
|
||||
<?php
|
||||
// 如果Key不为空,则加载天气插件!
|
||||
if ($WeatherPosition != 0){
|
||||
$WeatherFontColor = $theme_config['WeatherFontColor'];
|
||||
if ($WeatherFontColor == 1){
|
||||
$WeatherFontColor = $theme_config['HeadFontColor'];
|
||||
}elseif($WeatherFontColor == 2){
|
||||
$WeatherFontColor = $theme_config['TitleFontColor'];
|
||||
}
|
||||
?>
|
||||
<!--天气插件-->
|
||||
<script>
|
||||
WIDGET = {
|
||||
"CONFIG": {
|
||||
"modules": "01234", //实况温度、城市、天气状况、预警
|
||||
"background": "<?php echo $theme_config['WeatherBackground'];?>", //背景颜色
|
||||
"tmpColor": "<?php echo $WeatherFontColor ?>", //温度文字颜色
|
||||
"tmpSize": "16",
|
||||
"cityColor": "<?php echo $WeatherFontColor ?>", //城市名文字颜色
|
||||
"citySize": "16",
|
||||
"aqiColor": "<?php echo $WeatherFontColor ?>", //空气质量文字颜色
|
||||
"aqiSize": "16",
|
||||
"weatherIconSize": "24", //天气图标尺寸
|
||||
"alertIconSize": "18", //预警图标尺寸
|
||||
"padding": "5px 1px 5px 1px", //边距
|
||||
"borderRadius": "5", //圆角
|
||||
"key": "<?php echo $WeatherKey;?>"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script>
|
||||
<!--天气插件End-->
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -2,10 +2,9 @@
|
||||
"name":"默认主题(加强)",
|
||||
"description":"默认主题(加强)",
|
||||
"homepage":"https://gitee.com/tznb/TwoNav",
|
||||
"version":"2.1.0",
|
||||
"update":"2023/09/28",
|
||||
"version":"2.1.1",
|
||||
"update":"2024/04/14",
|
||||
"author":"落幕",
|
||||
"screenshot":"https://s3.bmp.ovh/imgs/2022/04/17/8cac968a8cc8135c.png",
|
||||
"config": {
|
||||
"HeadBackgroundColor":"#3f51b5",
|
||||
"SidebarBackgroundColor":"",
|
||||
@@ -19,12 +18,7 @@
|
||||
"CardNum":"0",
|
||||
"backgroundURL":"",
|
||||
"DescrRowNumber":"2",
|
||||
"night":"0",
|
||||
"WeatherBackground":"1",
|
||||
"WeatherKey":"dd2e9ab2728d4b3c91245fe4057cb9ce",
|
||||
"WeatherFontColor":"1",
|
||||
"WeatherPosition":"2",
|
||||
"ClickLocation":"0"
|
||||
"night":"0"
|
||||
},
|
||||
"support":{
|
||||
"subitem":0,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}
|
||||
$LoginConfig = unserialize($USER_DB['LoginConfig']);?>
|
||||
<?php if(!defined('DIR')){header('HTTP/1.1 404 Not Found');header("status: 404 Not Found");exit;}?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -31,20 +30,14 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
|
||||
<div class="center">
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-username"></span>
|
||||
<input type="text" name="User" lay-verify="required" placeholder="请输入账号">
|
||||
<input type="text" name="username" lay-verify="required" placeholder="请输入账号">
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-password"></span>
|
||||
<input type="password" name="Password" lay-verify="required" placeholder="请输入密码">
|
||||
<input type="password" name="password" lay-verify="required" placeholder="请输入密码">
|
||||
<span class="bind-password icon icon-4"></span>
|
||||
</div>
|
||||
<?php if(!empty($LoginConfig['totp_key'])){ ?>
|
||||
<div class="item">
|
||||
<span class="icon layui-icon layui-icon-vercode"></span>
|
||||
<input type="text" name="otp_code" lay-verify="required" placeholder="请输入OTP验证码">
|
||||
</div>
|
||||
<?php }?>
|
||||
</div>
|
||||
<div class="tip">
|
||||
<?php
|
||||
@@ -83,28 +76,73 @@ $LoginConfig = unserialize($USER_DB['LoginConfig']);?>
|
||||
});
|
||||
|
||||
|
||||
// 进行登录操作
|
||||
form.on('submit(login)', function (data) {
|
||||
data = data.field;
|
||||
if (data.User == '') {
|
||||
layer.msg('用户名不能为空');
|
||||
return false;
|
||||
}
|
||||
if (data.Password == '') {
|
||||
layer.msg('密码不能为空');
|
||||
return false;
|
||||
}
|
||||
data.Password = $.md5(data.Password);
|
||||
$.post('./index.php?c=<?php echo $c; ?>&u='+data.User,data,function(re,status){
|
||||
if(re.code == 1) {
|
||||
window.location.href = re.url;
|
||||
//账号登录
|
||||
form.on('submit(login)', function($form) {
|
||||
let url = `./?c=auth&mode=uname&t=` + Math.round(new Date() / 1000);
|
||||
form_data = $form.field;form_data.keep = 'on';
|
||||
form_data.password = $.md5(form_data.password);
|
||||
let load = layer.msg('正在登录..', {icon: 16,shade: [0.1, '#f5f5f5'],scrollbar: false,offset: 'auto',time: 60*1000});
|
||||
$.post(url,form_data,function(data,status){
|
||||
layer.close(load);
|
||||
if(data.code == 1) {
|
||||
layer.msg('登录成功', {icon: 1,shade: [0.1, '#f5f5f5'],scrollbar: false,offset: 'auto',time: 888,
|
||||
end: function() {
|
||||
window.location.href = data.url;
|
||||
}
|
||||
});
|
||||
}else if(data.code == 2){
|
||||
//双重认证
|
||||
layer.open({
|
||||
type: 1,
|
||||
title: false,
|
||||
content: $('.OTP'),
|
||||
move: '.move',
|
||||
success: function(layero, index, that){
|
||||
//监听回车事件
|
||||
$('input[name="otp_code"]').keydown(function(event) {
|
||||
if (event.which === 13) {
|
||||
$('button[lay-filter="validate_otp"]').click();
|
||||
}
|
||||
});
|
||||
//监听点击事件
|
||||
form.on('submit(validate_otp)', function ($form2) {
|
||||
form_data.otp_code = $form2.field.otp_code
|
||||
let load = layer.msg('正在验证..', {icon: 16,shade: [0.1, '#f5f5f5'],scrollbar: false,offset: 'auto',time: 60*1000});
|
||||
$.post(url,form_data,function(data,status){
|
||||
layer.close(load);
|
||||
if(data.code == 1) {
|
||||
layer.msg('登录成功', {icon: 1,shade: [0.1, '#f5f5f5'],scrollbar: false,offset: 'auto',time: 888,
|
||||
end: function() {
|
||||
window.location.href = data.url;
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(re.msg, {icon: 5});
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
return false;
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
<ul class="OTP" style="display:none;">
|
||||
<div class="layui-form layuimini-form layui-form-pane" style="padding: 20px 30px;">
|
||||
<div class="move" style="height: 30px;margin-bottom: 15px;text-align: center;font-size: 21px;">动态口令认证</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-group" style="width: 100%;">
|
||||
<input type="text" name="otp_code" lay-verify="required" lay-reqtext="请输入动态口令" placeholder="请输入动态口令" style="text-align: center;" class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-input-block" style="margin-left: 1px;"><button type="button" class="layui-btn layui-btn-fluid" lay-submit lay-filter="validate_otp">验证并登录</button></div>
|
||||
<div style="margin-top: 16px;font-size: 13px;color: #777;">* 如果您无法认证,请联系站长处理</div>
|
||||
</div>
|
||||
</ul>
|
||||
@@ -2,7 +2,7 @@
|
||||
"name": "默认模板",
|
||||
"description": "默认",
|
||||
"homepage": "https://gitee.com/tznb/TwoNav",
|
||||
"version": "2.1.0",
|
||||
"update": "2023/09/28",
|
||||
"version": "2.1.1",
|
||||
"update": "2023/12/20",
|
||||
"author": "TwoNav"
|
||||
}
|
||||
Reference in New Issue
Block a user