Browse Source

0.9.32

pull/161/head
xiaoz 10 months ago
parent
commit
fd5e9910e5
  1. 4
      README.md
  2. 4
      README_EN.md
  3. 6
      class/Api.php
  4. 9
      data/update.log
  5. 17
      functions/helper.php
  6. 7
      templates/admin/link_list.php
  7. 9
      templates/admin/setting/api.php
  8. 2
      version.txt

4
README.md

@ -53,11 +53,11 @@ OneNav是一款开源免费的书签(导航)管理程序,使用使用PHP + @@ -53,11 +53,11 @@ OneNav是一款开源免费的书签(导航)管理程序,使用使用PHP +
```bash
docker run -itd --name="onenav" -p 80:80 \
-v /data/onenav:/data/wwwroot/default/data \
helloz/onenav:0.9.30
helloz/onenav:0.9.32
```
* 第一个`80`是自定义访问端口,可以自行修改,第二个`80`是容器端口,请勿修改
* `/data/onenav`:本机挂载目录,用于持久存储Onenav数据
* `0.9.31`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号
* `0.9.32`:改成OneNav最新版本号,可以通过[releases](https://github.com/helloxz/onenav/releases)查看最新版本号
> 更多说明,请参考帮助文档:https://dwz.ovh/onenav

4
README_EN.md

@ -53,11 +53,11 @@ OneNav is an open-source, free bookmark (navigation) management program develope @@ -53,11 +53,11 @@ OneNav is an open-source, free bookmark (navigation) management program develope
```bash
docker run -itd --name="onenav" -p 80:80 \
-v /data/onenav:/data/wwwroot/default/data \
helloz/onenav:0.9.31
helloz/onenav:0.9.32
```
* The first `80` is the customized access port, which can be modified, and the second `80` is the container port, please do not modify
* `/data/onenav`: Local mount directory for persistent storage of Onenav data
* `0.9.31`: Replace with the latest version number of OneNav, which can be found through [releases](https://github.com/helloxz/onenav/releases)
* `0.9.32`: Replace with the latest version number of OneNav, which can be found through [releases](https://github.com/helloxz/onenav/releases)
> For more instructions, please refer to the help document: https://dwz.ovh/onenav

6
class/Api.php

@ -11,6 +11,8 @@ define("API_URL","https://onenav.xiaoz.top"); @@ -11,6 +11,8 @@ define("API_URL","https://onenav.xiaoz.top");
class Api {
protected $db;
public function __construct($db){
// 修改默认获取模式为关联数组
$db->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$this->db = $db;
//返回json类型
header('Content-Type:application/json; charset=utf-8');
@ -171,6 +173,10 @@ class Api { @@ -171,6 +173,10 @@ class Api {
* name:验证方法
*/
protected function auth($token){
// 当方法没有传递token的时候,则先尝试通过POST/GET获取token
if( empty($token) ) {
$token = empty( $_POST['token'] ) ? $_GET['token'] : $_POST['token'];
}
//计算正确的token:用户名 + TOKEN
$SecretKey = @$this->db->get('on_options','*',[ 'key' => 'SecretKey' ])['value'];
$token_yes = md5(USER.$SecretKey);

9
data/update.log

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

17
functions/helper.php

@ -185,4 +185,21 @@ function get_host(){ @@ -185,4 +185,21 @@ function get_host(){
$host = $parsed_host['host'];
}
return $host;
}
// 获取当前域名,比如https://nav.rss.ink
function getCurrentUrlDomain() {
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$url_parts = parse_url($url);
$domain = $url_parts['scheme'] . '://' . $url_parts['host'];
if(!empty($url_parts['port'])) {
$domain .= ':' . $url_parts['port'];
}
return $domain;
}

7
templates/admin/link_list.php

@ -28,7 +28,7 @@ @@ -28,7 +28,7 @@
<!-- 顶部搜索 -->
<div class="layui-inline">
<div class="layui-input-inline">
<input type="text" name="keyword" id="keyword" lay-verify="required" placeholder="请输入关键词" autocomplete="off" class="layui-input">
<input type="text" name="keyword" id="keyword" placeholder="请输入关键词" autocomplete="off" class="layui-input">
</div>
<div class="layui-input-inline" style="width: 100px;">
<button class="layui-btn" lay-submit lay-filter="search_keyword">搜索</button>
@ -120,6 +120,11 @@ layui.use(['table','form'], function(){ @@ -120,6 +120,11 @@ layui.use(['table','form'], function(){
console.log(data.field);
let keyword = data.field.keyword;
if( keyword.length < 2 ) {
layer.msg("关键词过短!",{icon:5});
return false;
}
//渲染链接列表
table.render({
elem: '#link_list'

9
templates/admin/setting/api.php

@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
<!-- 说明提示框 -->
<div class="layui-col-lg12">
<div class="setting-msg">
API使用说明,请参考:<a href="https://dwz.ovh/viot5" target = "_blank" title = "OneNav API使用说明">https://dwz.ovh/viot5</a>
API使用说明,请参考:<a href="https://dwz.ovh/viot5" target = "_blank" title = "OneNav API使用说明">https://dwz.ovh/viot5</a>
</div>
</div>
<!-- 说明提示框END -->
@ -22,6 +22,13 @@ @@ -22,6 +22,13 @@
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style = "width:130px;">API域名</label>
<div class="layui-input-inline">
<input style = "width:400px;" type="text" readonly="readonly" name="api_domain" value = "<?php echo getCurrentUrlDomain(); ?>" autocomplete="off" placeholder="OneNav API域名" class="layui-input">
</div>
</div>
<div class="layui-form-item">
<label class="layui-form-label" style = "width:130px;">SecretKey</label>
<div class="layui-input-inline">

2
version.txt

@ -1 +1 @@ @@ -1 +1 @@
v0.9.31-20230628
v0.9.32-20230714
Loading…
Cancel
Save