Browse Source

0.9.32

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

4
README.md

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

4
README_EN.md

@ -53,11 +53,11 @@ OneNav is an open-source, free bookmark (navigation) management program develope
```bash ```bash
docker run -itd --name="onenav" -p 80:80 \ docker run -itd --name="onenav" -p 80:80 \
-v /data/onenav:/data/wwwroot/default/data \ -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 * 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 * `/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 > 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");
class Api { class Api {
protected $db; protected $db;
public function __construct($db){ public function __construct($db){
// 修改默认获取模式为关联数组
$db->pdo->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$this->db = $db; $this->db = $db;
//返回json类型 //返回json类型
header('Content-Type:application/json; charset=utf-8'); header('Content-Type:application/json; charset=utf-8');
@ -171,6 +173,10 @@ class Api {
* name:验证方法 * name:验证方法
*/ */
protected function auth($token){ protected function auth($token){
// 当方法没有传递token的时候,则先尝试通过POST/GET获取token
if( empty($token) ) {
$token = empty( $_POST['token'] ) ? $_GET['token'] : $_POST['token'];
}
//计算正确的token:用户名 + TOKEN //计算正确的token:用户名 + TOKEN
$SecretKey = @$this->db->get('on_options','*',[ 'key' => 'SecretKey' ])['value']; $SecretKey = @$this->db->get('on_options','*',[ 'key' => 'SecretKey' ])['value'];
$token_yes = md5(USER.$SecretKey); $token_yes = md5(USER.$SecretKey);

7
data/update.log

@ -242,3 +242,10 @@ CREATE INDEX on_options_key_IDX ON on_options ("key");
c. 进入更多链接,显示返回按钮 c. 进入更多链接,显示返回按钮
4. 优化5iux主题 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

@ -186,3 +186,20 @@ function get_host(){
} }
return $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 @@
<!-- 顶部搜索 --> <!-- 顶部搜索 -->
<div class="layui-inline"> <div class="layui-inline">
<div class="layui-input-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>
<div class="layui-input-inline" style="width: 100px;"> <div class="layui-input-inline" style="width: 100px;">
<button class="layui-btn" lay-submit lay-filter="search_keyword">搜索</button> <button class="layui-btn" lay-submit lay-filter="search_keyword">搜索</button>
@ -120,6 +120,11 @@ layui.use(['table','form'], function(){
console.log(data.field); console.log(data.field);
let keyword = data.field.keyword; let keyword = data.field.keyword;
if( keyword.length < 2 ) {
layer.msg("关键词过短!",{icon:5});
return false;
}
//渲染链接列表 //渲染链接列表
table.render({ table.render({
elem: '#link_list' elem: '#link_list'

7
templates/admin/setting/api.php

@ -22,6 +22,13 @@
</div> </div>
</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"> <div class="layui-form-item">
<label class="layui-form-label" style = "width:130px;">SecretKey</label> <label class="layui-form-label" style = "width:130px;">SecretKey</label>
<div class="layui-input-inline"> <div class="layui-input-inline">

2
version.txt

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