Skip to content

Commit fd5e991

Browse files
committed
0.9.32
1 parent 30e5bd3 commit fd5e991

File tree

8 files changed

+50
-8
lines changed

8 files changed

+50
-8
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ OneNav是一款开源免费的书签(导航)管理程序,使用使用PHP +
5353
```bash
5454
docker run -itd --name="onenav" -p 80:80 \
5555
-v /data/onenav:/data/wwwroot/default/data \
56-
helloz/onenav:0.9.30
56+
helloz/onenav:0.9.32
5757
```
5858
* 第一个`80`是自定义访问端口,可以自行修改,第二个`80`是容器端口,请勿修改
5959
* `/data/onenav`:本机挂载目录,用于持久存储Onenav数据
60-
* `0.9.31`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号
60+
* `0.9.32`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号
6161

6262
> 更多说明,请参考帮助文档:https://dwz.ovh/onenav
6363

README_EN.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ OneNav is an open-source, free bookmark (navigation) management program develope
5353
```bash
5454
docker run -itd --name="onenav" -p 80:80 \
5555
-v /data/onenav:/data/wwwroot/default/data \
56-
helloz/onenav:0.9.31
56+
helloz/onenav:0.9.32
5757
```
5858
* The first `80` is the customized access port, which can be modified, and the second `80` is the container port, please do not modify
5959
* `/data/onenav`: Local mount directory for persistent storage of Onenav data
60-
* `0.9.31`: Replace with the latest version number of OneNav, which can be found through [releases](https://github.com/helloxz/onenav/releases)
60+
* `0.9.32`: Replace with the latest version number of OneNav, which can be found through [releases](https://github.com/helloxz/onenav/releases)
6161

6262
> For more instructions, please refer to the help document: https://dwz.ovh/onenav
6363

class/Api.php

+6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class Api {
1212
protected $db;
1313
public function __construct($db){
14+
// 修改默认获取模式为关联数组
15+
$db->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
1416
$this->db = $db;
1517
//返回json类型
1618
header('Content-Type:application/json; charset=utf-8');
@@ -171,6 +173,10 @@ public function err_msg($code,$err_msg){
171173
* name:验证方法
172174
*/
173175
protected function auth($token){
176+
// 当方法没有传递token的时候,则先尝试通过POST/GET获取token
177+
if( empty($token) ) {
178+
$token = empty( $_POST['token'] ) ? $_GET['token'] : $_POST['token'];
179+
}
174180
//计算正确的token:用户名 + TOKEN
175181
$SecretKey = @$this->db->get('on_options','*',[ 'key' => 'SecretKey' ])['value'];
176182
$token_yes = md5(USER.$SecretKey);

data/update.log

+8-1
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,11 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
241241
b. 进入更多链接遮罩左侧导航栏
242242
c. 进入更多链接,显示返回按钮
243243
4. 优化5iux主题
244-
5. 优化webstack主题
244+
5. 优化webstack主题
245+
246+
20230714
247+
1. API认证函数增加了尝试自动获取token,避免部分函数忘记获取token,导致token认证失败
248+
2. 修复查询分类链接要求输入关键词的BUG
249+
3. 修改Medoo默认获取模式为关联数组,避免过多冗余数据
250+
4. 重构OneNav Chrome扩展
251+
5. 后台获取API页面,新增API域名显示

functions/helper.php

+17
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,21 @@ function get_host(){
185185
$host = $parsed_host['host'];
186186
}
187187
return $host;
188+
}
189+
190+
// 获取当前域名,比如https://nav.rss.ink
191+
function getCurrentUrlDomain() {
192+
193+
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
194+
195+
$url_parts = parse_url($url);
196+
197+
$domain = $url_parts['scheme'] . '://' . $url_parts['host'];
198+
199+
if(!empty($url_parts['port'])) {
200+
$domain .= ':' . $url_parts['port'];
201+
}
202+
203+
return $domain;
204+
188205
}

templates/admin/link_list.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<!-- 顶部搜索 -->
2929
<div class="layui-inline">
3030
<div class="layui-input-inline">
31-
<input type="text" name="keyword" id="keyword" lay-verify="required" placeholder="请输入关键词" autocomplete="off" class="layui-input">
31+
<input type="text" name="keyword" id="keyword" placeholder="请输入关键词" autocomplete="off" class="layui-input">
3232
</div>
3333
<div class="layui-input-inline" style="width: 100px;">
3434
<button class="layui-btn" lay-submit lay-filter="search_keyword">搜索</button>
@@ -120,6 +120,11 @@
120120
console.log(data.field);
121121
let keyword = data.field.keyword;
122122

123+
if( keyword.length < 2 ) {
124+
layer.msg("关键词过短!",{icon:5});
125+
return false;
126+
}
127+
123128
//渲染链接列表
124129
table.render({
125130
elem: '#link_list'

templates/admin/setting/api.php

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- 说明提示框 -->
99
<div class="layui-col-lg12">
1010
<div class="setting-msg">
11-
API使用说明,请参考:<a href="https://dwz.ovh/viot5" target = "_blank" title = "OneNav API使用说明">https://dwz.ovh/viot5</a>
11+
API使用说明,请参考:<a href="https://dwz.ovh/viot5" target = "_blank" title = "OneNav API使用说明">https://dwz.ovh/viot5</a>
1212
</div>
1313
</div>
1414
<!-- 说明提示框END -->
@@ -22,6 +22,13 @@
2222
</div>
2323
</div>
2424

25+
<div class="layui-form-item">
26+
<label class="layui-form-label" style = "width:130px;">API域名</label>
27+
<div class="layui-input-inline">
28+
<input style = "width:400px;" type="text" readonly="readonly" name="api_domain" value = "<?php echo getCurrentUrlDomain(); ?>" autocomplete="off" placeholder="OneNav API域名" class="layui-input">
29+
</div>
30+
</div>
31+
2532
<div class="layui-form-item">
2633
<label class="layui-form-label" style = "width:130px;">SecretKey</label>
2734
<div class="layui-input-inline">

version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v0.9.31-20230628
1+
v0.9.32-20230714

0 commit comments

Comments
 (0)