diff --git a/README.md b/README.md index c936d93..db865ae 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ TwoNav 是一款开源免费的书签(导航)管理程序,界面简洁, * 数据库: SQLite3 或 MySQL > 5.6.0 ### 功能特色 -* 支持 * 支持后台管理 * 支持私有链接 * 支持加密链接 diff --git a/system/api.php b/system/api.php index d9e62b6..bead119 100644 --- a/system/api.php +++ b/system/api.php @@ -944,7 +944,7 @@ function write_site_setting(){ 'keywords'=>['empty'=>true], 'description'=>['empty'=>true], 'link_model'=>['v'=>['direct','Privacy','Privacy_js','Privacy_meta','301','302','Transition'],'msg'=>'链接模式参数错误'], - 'main_link_priority'=>['int'=>true,'min'=>0,'max'=>1,'msg'=>'主链优先参数错误'], + 'main_link_priority'=>['int'=>true,'min'=>0,'max'=>3,'msg'=>'主链优先参数错误'], 'link_icon'=>['int'=>true,'min'=>0,'max'=>10,'msg'=>'链接图标参数错误'], 'site_icon'=>['empty'=>true], 'top_link'=>['int'=>true,'min'=>0,'max'=>20,'msg'=>'热门链接参数错误'], diff --git a/system/click.php b/system/click.php index 03e43b9..f2184f7 100644 --- a/system/click.php +++ b/system/click.php @@ -132,9 +132,9 @@ if($global_config['link_extend'] == 1 && check_purview('link_extend',1) && in_ar if(!empty($link['url_standby'])) { $link['url_standby'] = unserialize($link['url_standby']); //主链优先模式 - if($site['main_link_priority'] == 1){ - $code = get_http_code($link['url'],3); - if(in_array(intval($code),[200,301,302]) ){ + if(!empty($site['main_link_priority']) && $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']; }else{ require $transit_path; diff --git a/system/index.php b/system/index.php index 86c7d67..61ce606 100644 --- a/system/index.php +++ b/system/index.php @@ -164,7 +164,7 @@ function get_links($fid) { $click = false; $lock = false; //直连模式,但存在备用链接 - if ($site['link_model'] == 'direct' && !empty($link['url_standby'])){ + if ($site['link_model'] == 'direct' && $site['main_link_priority'] != '3' && !empty($link['url_standby'])){ $click = true; } diff --git a/system/public.php b/system/public.php index de24e63..01d20e3 100644 --- a/system/public.php +++ b/system/public.php @@ -497,11 +497,11 @@ function Get_IP() { } //获取URL状态码 -function get_http_code($url,$TIMEOUT = 10) { +function get_http_code($url,$TIMEOUT = 10 ,$NOBODY = true) { $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 1); - curl_setopt($curl, CURLOPT_NOBODY, true); + curl_setopt($curl, CURLOPT_NOBODY, $NOBODY); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, $TIMEOUT); curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.69 Safari/537.36'); diff --git a/system/version.txt b/system/version.txt index 0cb23ac..20e097c 100644 --- a/system/version.txt +++ b/system/version.txt @@ -1 +1 @@ -v2.0.18-20230510 \ No newline at end of file +v2.0.19-20230515 \ No newline at end of file diff --git a/templates/admin/js/link.js b/templates/admin/js/link.js index 7e42b2d..06b38e2 100644 --- a/templates/admin/js/link.js +++ b/templates/admin/js/link.js @@ -40,13 +40,20 @@ layui.use(['form','upload','miniTab'], function () { } return false; } - layer.msg('添加成功!', {icon: 1,time: 600, + layer.msg('添加成功!', {icon: 1,time: 700, end: function() { if(_GET('source') == 'tpl'){ //第三方调用时刷新父页面 parent.location.reload(); }else if(_GET('source')=='link_list'){ // 链接列表调用 parent.layui.table.reload('table');//刷新父页面的表格 $('#close').click();//关闭子页面 + }else{ + if($("#continuity").is(":checked")){ + location.reload(); + }else{ + $('#close').click(); + } + } } }); @@ -181,6 +188,10 @@ layui.use(['form','upload','miniTab'], function () { $("#reset").click(); //加载预览图 preview_icon(form_data.icon); + }else{ + if(_GET('fid') > 0){ + form.val('form',{"fid":_GET('fid')}); + } } //layui>end diff --git a/templates/admin/js/link_list.js b/templates/admin/js/link_list.js index 792a63b..741cdae 100644 --- a/templates/admin/js/link_list.js +++ b/templates/admin/js/link_list.js @@ -143,7 +143,7 @@ layui.use(['form','table','dropdown','miniTab'], function () { maxmin:false, shadeClose: true, area: ['100%', '100%'], - content: './index.php?c=admin&page=link_add&source=link_list&u=' + u, + content: './index.php?c=admin&page=link_add&source=link_list&u=' + u +"&fid=" + $('#fid').val(), }); //做一个关闭时检查是否需要刷新数据? return; diff --git a/templates/admin/page/SiteSetting.php b/templates/admin/page/SiteSetting.php index dc8148c..fa25d2e 100644 --- a/templates/admin/page/SiteSetting.php +++ b/templates/admin/page/SiteSetting.php @@ -57,7 +57,9 @@