mirror of
https://github.com/tznb1/TwoNav.git
synced 2025-08-10 08:51:49 +00:00
v2.1.06-20231113
This commit is contained in:
@@ -72,7 +72,7 @@ if(!empty($regcode_info['u_group'])){
|
||||
}
|
||||
|
||||
//读取用户组信息,如果用户组不存在则设为默认用户组
|
||||
if($UserGroup != 'default'){
|
||||
if(!in_array($UserGroup,['default','root','visitor'])){
|
||||
$Group = get_db('user_group','*',['code' => $UserGroup]);
|
||||
if(empty( $Group )){
|
||||
$UserGroup = 'default';
|
||||
|
||||
@@ -1132,7 +1132,10 @@ function read_theme(){
|
||||
msgA(['code'=>1,'data'=>$themes,'current'=>$current,'referrer'=>($data['referrer'] ?? '')]);
|
||||
}
|
||||
function msg_tip(){
|
||||
msg(-1,'免费版不支持此功能,购买授权版<br /> <a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank" style="color: #1e9fff;">点击此处前往购买页面</a>');
|
||||
if(is_subscribe()){
|
||||
msg(-1,'请前往概要页面更新系统,未提示更新则尝试刷新页面<br />更新后即可解锁全部功能,如有疑问请联系客服');
|
||||
}
|
||||
msg(-1,'免费版不支持此功能<br /> <a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank" style="color: #1e9fff;">点击此处前往购买页面</a>');
|
||||
}
|
||||
|
||||
//主题下载/更新/删除
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.1.05-20231106
|
||||
v2.1.06-20231113
|
||||
@@ -35,6 +35,7 @@
|
||||
<dl class="layui-nav-child">
|
||||
<dd><a href="javascript:;" layuimini-content-href="LoginDevice" data-title="登录设备">登录设备</a></dd>
|
||||
<dd><a href="javascript:;" layuimini-content-href="SecuritySetting" data-title="安全设置">安全设置</a></dd>
|
||||
<dd><a href="javascript:;" layuimini-content-href="AccessRestrictions" data-title="访问限制">访问限制</a></dd>
|
||||
<dd><a href="javascript:;" layuimini-content-href="UserPassword" data-title="修改密码">修改密码</a></dd>
|
||||
<dd><hr></dd>
|
||||
<dd><a href="javascript:;" id="logout">退出登录</a></dd>
|
||||
|
||||
@@ -9,14 +9,22 @@ layui.use(['layer','miniTab'], function(){
|
||||
|
||||
// 获取最新信息
|
||||
$.post(get_api('other_services','get_notice'),function(data,status){
|
||||
console.log(data );
|
||||
if(data.code == 200) {
|
||||
$("#new_ver a").text(data.version);
|
||||
$('#notice_link').text('');
|
||||
data.notice.forEach(notice => {
|
||||
$('#notice_link').append(`<div class="layuimini-notice"><div class="layuimini-notice-title"><a href="${notice.url}" target="_blank">${notice.title}</a></div></div>`);
|
||||
});
|
||||
$('#notice_text').html(data.message);
|
||||
if (Array.isArray(data.notice) && data.notice.length > 0) {
|
||||
data.notice.forEach(notice => {
|
||||
$('#notice_link').append(`<div class="layuimini-notice"><div class="layuimini-notice-title"><a href="${notice.url}" target="_blank">${notice.title}</a></div></div>`);
|
||||
});
|
||||
}else{
|
||||
$('.notice1').remove();
|
||||
}
|
||||
if(data.message.length > 0){
|
||||
$('#notice_text').html(data.message);
|
||||
}else{
|
||||
$('.notice2').remove();
|
||||
}
|
||||
|
||||
}
|
||||
init_update();
|
||||
$(".update").remove();
|
||||
|
||||
71
templates/admin/page/AccessRestrictions.php
Normal file
71
templates/admin/page/AccessRestrictions.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php $title='访问限制'; require '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;}
|
||||
</style>
|
||||
<body>
|
||||
<div class="layuimini-container">
|
||||
<div class="layuimini-main">
|
||||
<form class="layui-form" lay-filter="form">
|
||||
<div class="layui-form layuimini-form layui-form-pane">
|
||||
<blockquote class="layui-elem-quote layui-text" style="">
|
||||
此功能<a href="https://gitee.com/tznb/TwoNav/wikis/pages?sort_id=7968669&doc_id=3767990" target="_blank">授权用户</a>专享
|
||||
</blockquote>
|
||||
<blockquote class="layui-elem-quote layui-text" style="">白名单模式 > 除了名单中的账号和分组一律不可访问您的主页<br />黑名单模式 > 黑名单中的账号和分组不可访问您的主页<br />匹配优先级: 用户组名单 > 账号名单<br />使用黑白名单模式时,未登录账号不可访问您的主页<br />名单中多个账号或分组时用半角的逗号,间隔<br />新增功能,难免会有BUG,如有遇到请反馈并关闭该功能</blockquote>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">访问限制</label>
|
||||
<div class="layui-input-inline" >
|
||||
<select name="mode">
|
||||
<option value="0" selected="">无限制</option>
|
||||
<option value="white">白名单模式</option>
|
||||
<option value="black">黑名单模式</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux"></div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">用户组名单</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="users_list" class="layui-textarea" placeholder='填写用户组代号,例如: group1,group2,group3'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">账号名单</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="user_list" class="layui-textarea" placeholder='填写用户账号,例如: user1,user2,user3'></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">限制提示</label>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="prompt" class="layui-textarea" placeholder='留空时: 显示引导页
|
||||
以http开头时: 跳转到url
|
||||
其他内容则直接显示'></textarea>
|
||||
</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>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script src = "<?php echo $libs;?>/jquery/jquery-3.6.0.min.js"></script>
|
||||
<?php load_static('js.layui');?>
|
||||
<script>
|
||||
layui.use(['jquery','form','miniTab'], function () {
|
||||
var form = layui.form;
|
||||
var layer = layui.layer;
|
||||
var $ = layui.jquery;
|
||||
var miniTab = layui.miniTab;
|
||||
miniTab.listen();
|
||||
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -195,13 +195,18 @@ layui.use(['jquery','form','upload'], function () {
|
||||
});
|
||||
//监听提交
|
||||
form.on('submit(save)', function (data) {
|
||||
layer.load(0);
|
||||
$.post('./index.php?c=api&method=write_site_setting&u='+u,data.field,function(data,status){
|
||||
layer.closeLast('loading');
|
||||
if(data.code == 1) {
|
||||
layer.msg(data.msg, {icon: 1});
|
||||
}else{
|
||||
layer.msg(data.msg, {icon: 5});
|
||||
}
|
||||
});
|
||||
}).fail(function(xhr, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
layer.alert('请求失败');
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ $data = empty($Notice)?[]:json_decode($Notice, true);
|
||||
|
||||
//输出最新动态
|
||||
function echo_notice_link($data){
|
||||
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-bullhorn icon"></i>最新动态</div><div class="layui-card-body layui-text" id="notice_link">';
|
||||
echo '<div class="layui-card notice1"><div class="layui-card-header"><i class="fa fa-bullhorn icon"></i>最新动态</div><div class="layui-card-body layui-text" id="notice_link">';
|
||||
foreach($data["notice"] as $value){
|
||||
echo "<div class=\"layuimini-notice\"><div class=\"layuimini-notice-title\"><a href=\"{$value['url']}\" target=\"_blank\">{$value['title']}</a></div></div>";
|
||||
}
|
||||
@@ -17,7 +17,7 @@ function echo_notice_link($data){
|
||||
|
||||
//输出官方公告
|
||||
function echo_notice_text($data){
|
||||
echo '<div class="layui-card"><div class="layui-card-header"><i class="fa fa-bell-o icon"></i>官方公告</div><div class="layui-card-body layui-text layadmin-text" id="notice_text">';
|
||||
echo '<div class="layui-card notice2"><div class="layui-card-header"><i class="fa fa-bell-o icon"></i>官方公告</div><div class="layui-card-body layui-text layadmin-text" id="notice_text">';
|
||||
echo $data['message'];
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
@@ -69,16 +69,22 @@ layui.use(['layer','form','miniTab'], function () {
|
||||
});
|
||||
//一键诊断
|
||||
$('.diagnose').on('click', function(){
|
||||
layer.load(0);
|
||||
$("#console_log").text("");
|
||||
$("#console_log").append("浏览器UA:" + navigator.userAgent +"\n");
|
||||
$("#console_log").append("客户端时间:" + timestampToTime(Math.round(new Date() / 1000) ) +"\n");
|
||||
$.post(get_api('read_data','diagnostic_log'),function(data,status){
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(data.msg);
|
||||
}).fail(function(xhr, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
layer.alert('请求失败');
|
||||
});
|
||||
});
|
||||
|
||||
//连通测试
|
||||
$('.connectivity_test').on('click', function(){
|
||||
layer.load(0);
|
||||
$("#console_log").text("");
|
||||
$("#console_log").append("浏览器UA:" + navigator.userAgent +"\n");
|
||||
$("#console_log").append("客户端时间:" + timestampToTime(Math.round(new Date() / 1000) ) +"\n");
|
||||
@@ -94,12 +100,13 @@ layui.use(['layer','form','miniTab'], function () {
|
||||
url: get_api('read_data', 'connectivity_test'),
|
||||
type: 'POST',
|
||||
data: { url: url },
|
||||
async: false,
|
||||
//async: false,
|
||||
success: function(data, status) {
|
||||
$("#console_log").append(data.msg + "\n");
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
$("#console_log").append(routeName + ": 请求 " + url + " 发生错误:" + errorThrown + "\n");
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(data.msg + "\n");
|
||||
},error: function(jqXHR, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").append(routeName + ": 请求 " + url + " 发生错误:" + errorThrown + "\n");
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -146,21 +153,31 @@ layui.use(['layer','form','miniTab'], function () {
|
||||
});
|
||||
//清理缓存
|
||||
$('.CleanCache').on('click', function(){
|
||||
layer.load(0);
|
||||
$.post(get_api('other_root','CleanCache'),function(data,status){
|
||||
layer.closeLast('loading');
|
||||
if(data.code == 1){
|
||||
layer.msg(data.msg,{icon: 1})
|
||||
} else{
|
||||
layer.msg(data.msg,{icon: 5});
|
||||
}
|
||||
}).fail(function(xhr, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
layer.alert('请求失败');
|
||||
});
|
||||
});
|
||||
//数据库升级
|
||||
$('.db_upgrade').on('click', function(){
|
||||
layer.load(0);
|
||||
$("#console_log").text("");
|
||||
$("#console_log").append(`正在处理中,请勿操作页面...\n`);
|
||||
$.post(get_api("other_upsys"),{"i":4,"pattern":"manual"}, function(data, status) {
|
||||
layer.closeLast('loading');
|
||||
$("#console_log").text("");
|
||||
$("#console_log").append(`${data.msg}\n`);
|
||||
}).fail(function(xhr, textStatus, errorThrown) {
|
||||
layer.closeLast('loading');
|
||||
layer.alert('请求失败');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -5,7 +5,22 @@
|
||||
<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.05-20231106</h4>
|
||||
<h4 class="layui-timeline-title">v2.1.06-20231113</h4>
|
||||
<ul>
|
||||
<li>[修复] 开启离线模式时概要页依旧获取在线数据,V0921</li>
|
||||
<li>[优化] 为部分操作添加处理中的效果( 防止网络极差的用户以为没点到而重复点击 )</li>
|
||||
<li>[新增] 内置用户组新增:访客 (代号:visitor,处于该用户组的账号登录后跳转到默认用户的主页,配合引导页使用实现需注册登录才能访问站点)</li>
|
||||
<li>[备注] 由于访客无权限进入后台,所以也无法自助修改密码</li>
|
||||
<li>[新增] 在用户组列表中显示内置用户组 ( 默认/访客/站长 )</li>
|
||||
<li>[变更] 系统设置中的默认分组允许设置为内置用户组 ( 例如设为访客 )</li>
|
||||
<li>[新增] 访问限制 (右上角账号下拉),可设置:无限制/白名单/黑名单,具体查看页面中的说明</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.05-20231107</h4>
|
||||
<ul>
|
||||
<li>[修复] 使用MySQL/MariaDB数据库时记录访客IP错误</li>
|
||||
<li>[修复] 注册模板/引导页模板配置无法正常读取</li>
|
||||
|
||||
Reference in New Issue
Block a user