Code Monkey home page Code Monkey logo

Comments (29)

lmuiotctf avatar lmuiotctf commented on May 20, 2024 1

MySQL测试下已经🆗
image

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

大家一般用 Docker 来部署,这个我感觉意义不大哈。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

只有我用GO部署嘛 哈哈哈

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

Docker 的话主要是更新很方便,如果用 MySQL & Redis 的话,应该配合 Docker Compose 使用。

而 One API 里面需要设置环境变量的也主要就这两个。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

目前还不是采用MYSQL吧,看了下是SQLite,有计划把微信公众号合并到这里嘛

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

这样的话,是不是少了个sql库,可以直接改成mysql

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

配置环境变量 SQL_DSN 就好,MySQL 是原本就支持的,不过未测试可能会有问题。

本项目基于我的模板项目 gin-template,对于 MySQL 的支持也是继承于该项目。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

确实,启动之后可能是我的库5.7版本过低。报错

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

可以看一下报错信息吗?

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

CREATE TABLE tokens (id bigint AUTO_INCREMENT,user_id bigint,key longtext,status bigint DEFAULT 1,name varchar(191),created_time bigint,accessed_time bigint,expired_time bigint DEFAULT -1,remain_times bigint DEFAULT 0,unlimited_times boolean DEFAULT false,PRIMARY KEY (id),INDEX idx_tokens_name (name),UNIQUE INDEX idx_tokens_key (key))
[FATAL] 2023/04/26 - 14:19:54 | [Error 1170: BLOB/TEXT column 'key' used in key specification without a key length]

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

Okay,有时间处理一下这个问题。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

辛苦

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

已修复,版本 v0.1.6-alpha 已推送,期待反馈。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

目前问题:渠道和令牌表id没有自增,会报错,记得改下

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

可以看一下报错信息吗?我现在没有 MySQL 环境可以测试。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

我刚刚改了这两张表就可以,报错是:id没有值,没有自动递增
image

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

我记得另一个项目里是可以自动递增的,不然主键冲突肯定会报错的。

我回去之后有了 MySQL 环境后再测试一下。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

目前普通用户可以自己创建令牌,但是超级管理员应该可以查看到普通用户创建的令牌。(目前管理员仅能看到自己)
逻辑应该是普通用户仅有创建令牌的功能,但是没有权限进行设置次数和到期时间,这两个应该交给管理员来控制

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

普通用户没法设置次数的,需要使用兑换码,而兑换码只能管理员生成。

到期时间这个,感觉放开给用户无所谓。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

不好意思刚刚页面没有刷新,应该卡bug了(刚刚普通用户居然可以输入次数,现在不可以了)
image

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

#9

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

应该是你刚刚登录了管理员账户,这个就算他能输入后端也不会给改的。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

超级管理员应该可以查看到普通用户创建的令牌。(目前管理员仅能看到自己)
我觉得这点可以加上,超管支持查看所有的令牌

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

感觉管理员管理用户的令牌意义不大哈,如果用户有问题可以直接封禁用户的。

不过我突然意识到令牌校验时并没有检查用户的状态,导致用户被禁用后令牌还能用。

from one-api.

lmuiotctf avatar lmuiotctf commented on May 20, 2024

这个可以进行优化下

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

Okay,不过管理员管理用户令牌这个,应该单独开一个 issue,和当前 issue 主题关系不大不方便归档哈

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

目前问题:渠道和令牌表id没有自增,会报错,记得改下

MySQL 8.0.27 未能复现。

from one-api.

songquanpeng avatar songquanpeng commented on May 20, 2024

如果新版本依旧有问题,欢迎重开 issue。

from one-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.