Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
483bd64d
authored
Apr 22, 2023
by
JustSong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename to One API
parent
4cbef078
Hide whitespace changes
Inline
Side-by-side
Showing
39 changed files
with
110 additions
and
108 deletions
+110
-108
.github/workflows/docker-image-amd64.yml
+1
-1
.github/workflows/docker-image-arm64.yml
+1
-1
.github/workflows/linux-release.yml
+5
-4
.github/workflows/macos-release.yml
+2
-2
.github/workflows/windows-release.yml
+3
-2
Dockerfile
+3
-3
README.en.md
+20
-20
README.md
+22
-22
common/constants.go
+2
-2
controller/file.go
+2
-2
controller/github.go
+2
-2
controller/misc.go
+2
-2
controller/option.go
+2
-2
controller/user.go
+2
-2
controller/wechat.go
+2
-2
go.mod
+1
-1
main.go
+4
-4
middleware/auth.go
+2
-2
middleware/cors.go
+1
-1
middleware/rate-limit.go
+1
-1
middleware/turnstile-check.go
+1
-1
model/file.go
+1
-1
model/main.go
+1
-1
model/option.go
+1
-1
model/user.go
+1
-1
router/api-router.go
+2
-2
router/web-router.go
+3
-3
web/public/favicon.ico
+0
-0
web/public/index.html
+1
-1
web/public/logo.png
+0
-0
web/src/components/Footer.js
+2
-2
web/src/components/Header.js
+2
-2
web/src/components/LoginForm.js
+3
-3
web/src/components/OtherSetting.js
+2
-2
web/src/components/PasswordResetConfirm.js
+2
-2
web/src/components/PasswordResetForm.js
+2
-2
web/src/components/PersonalSetting.js
+2
-2
web/src/components/RegisterForm.js
+2
-2
web/src/pages/About/index.js
+2
-2
No files found.
.github/workflows/docker-image-amd64.yml
View file @
483bd64d
...
...
@@ -42,7 +42,7 @@ jobs:
uses
:
docker/metadata-action@v4
with
:
images
:
|
justsong/
gin-template
justsong/
one-api
ghcr.io/${{ github.repository }}
-
name
:
Build and push Docker images
...
...
.github/workflows/docker-image-arm64.yml
View file @
483bd64d
...
...
@@ -48,7 +48,7 @@ jobs:
uses
:
docker/metadata-action@v4
with
:
images
:
|
justsong/
gin-template
justsong/
one-api
ghcr.io/${{ github.repository }}
-
name
:
Build and push Docker images
...
...
.github/workflows/linux-release.yml
View file @
483bd64d
...
...
@@ -30,20 +30,20 @@ jobs:
-
name
:
Build Backend (amd64)
run
:
|
go mod download
go build -ldflags "-s -w -X '
gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template
go build -ldflags "-s -w -X '
one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
-
name
:
Build Backend (arm64)
run
:
|
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X '
gin-template/common.Version=$(git describe --tags)' -extldflags '-static'" -o gin-template
-arm64
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X '
one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api
-arm64
-
name
:
Release
uses
:
softprops/action-gh-release@v1
if
:
startsWith(github.ref, 'refs/tags/')
with
:
files
:
|
gin-template
gin-template
-arm64
one-api
one-api
-arm64
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
.github/workflows/macos-release.yml
View file @
483bd64d
...
...
@@ -30,11 +30,11 @@ jobs:
-
name
:
Build Backend
run
:
|
go mod download
go build -ldflags "-X '
gin-template/common.Version=$(git describe --tags)'" -o gin-template
-macos
go build -ldflags "-X '
one-api/common.Version=$(git describe --tags)'" -o one-api
-macos
-
name
:
Release
uses
:
softprops/action-gh-release@v1
if
:
startsWith(github.ref, 'refs/tags/')
with
:
files
:
gin-template
-macos
files
:
one-api
-macos
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
.github/workflows/windows-release.yml
View file @
483bd64d
...
...
@@ -33,11 +33,11 @@ jobs:
-
name
:
Build Backend
run
:
|
go mod download
go build -ldflags "-s -w -X '
gin-template/common.Version=$(git describe --tags)'" -o gin-template
.exe
go build -ldflags "-s -w -X '
one-api/common.Version=$(git describe --tags)'" -o one-api
.exe
-
name
:
Release
uses
:
softprops/action-gh-release@v1
if
:
startsWith(github.ref, 'refs/tags/')
with
:
files
:
gin-template
.exe
files
:
one-api
.exe
env
:
GITHUB_TOKEN
:
${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
Dockerfile
View file @
483bd64d
...
...
@@ -16,7 +16,7 @@ WORKDIR /build
COPY
. .
COPY
--from=builder /build/build ./web/build
RUN
go mod download
RUN
go build
-ldflags
"-s -w -X '
gin-template/common.Version=
$(
cat
VERSION
)
' -extldflags '-static'"
-o
gin-template
RUN
go build
-ldflags
"-s -w -X '
one-api/common.Version=
$(
cat
VERSION
)
' -extldflags '-static'"
-o
one-api
FROM
alpine
...
...
@@ -25,7 +25,7 @@ RUN apk update \
&&
apk add
--no-cache
ca-certificates tzdata
\
&&
update-ca-certificates 2>/dev/null
||
true
ENV
PORT=3000
COPY
--from=builder2 /build/
gin-template
/
COPY
--from=builder2 /build/
one-api
/
EXPOSE
3000
WORKDIR
/data
ENTRYPOINT
["/
gin-template
"]
ENTRYPOINT
["/
one-api
"]
README.en.md
View file @
483bd64d
...
...
@@ -3,7 +3,7 @@
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/
gin-template"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/gin-template/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"gin-template
logo"
></a>
<a
href=
"https://github.com/songquanpeng/
one-api"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"one-api
logo"
></a>
</p>
<div
align=
"center"
>
...
...
@@ -15,28 +15,28 @@ _✨ Template for Gin & React projects ✨_
</div>
<p
align=
"center"
>
<a
href=
"https://raw.githubusercontent.com/songquanpeng/
gin-template
/main/LICENSE"
>
<img
src=
"https://img.shields.io/github/license/songquanpeng/
gin-template
?color=brightgreen"
alt=
"license"
>
<a
href=
"https://raw.githubusercontent.com/songquanpeng/
one-api
/main/LICENSE"
>
<img
src=
"https://img.shields.io/github/license/songquanpeng/
one-api
?color=brightgreen"
alt=
"license"
>
</a>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases/latest"
>
<img
src=
"https://img.shields.io/github/v/release/songquanpeng/
gin-template
?color=brightgreen&include_prereleases"
alt=
"release"
>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases/latest"
>
<img
src=
"https://img.shields.io/github/v/release/songquanpeng/
one-api
?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases/latest"
>
<img
src=
"https://img.shields.io/github/downloads/songquanpeng/
gin-template
/total?color=brightgreen&include_prereleases"
alt=
"release"
>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases/latest"
>
<img
src=
"https://img.shields.io/github/downloads/songquanpeng/
one-api
/total?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://goreportcard.com/report/github.com/songquanpeng/go-file"
>
<img
src=
"https://goreportcard.com/badge/github.com/songquanpeng/
gin-template
"
alt=
"GoReportCard"
>
<img
src=
"https://goreportcard.com/badge/github.com/songquanpeng/
one-api
"
alt=
"GoReportCard"
>
</a>
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases"
>
Download
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases"
>
Download
</a>
·
<a
href=
"https://github.com/songquanpeng/
gin-template
/blob/main/README.en.md#deployment"
>
Tutorial
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
/blob/main/README.en.md#deployment"
>
Tutorial
</a>
·
<a
href=
"https://github.com/songquanpeng/
gin-template
/issues"
>
Feedback
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
/issues"
>
Feedback
</a>
·
<a
href=
"https://
gin-template
.vercel.app/"
>
Demo
</a>
<a
href=
"https://
one-api
.vercel.app/"
>
Demo
</a>
</p>
## Features
...
...
@@ -54,23 +54,23 @@ _✨ Template for Gin & React projects ✨_
## Deployment
### Manual deployment
1.
Download built binary from
[
GitHub Releases
](
https://github.com/songquanpeng/
gin-template
/releases/latest
)
or build from source:
1.
Download built binary from
[
GitHub Releases
](
https://github.com/songquanpeng/
one-api
/releases/latest
)
or build from source:
```shell
git clone https://github.com/songquanpeng/
gin-template
.git
git clone https://github.com/songquanpeng/
one-api
.git
go mod download
go build -ldflags "-s -w" -o
gin-template
go build -ldflags "-s -w" -o
one-api
````
2. Run it:
```shell
chmod u+x
gin-template
./
gin-template
--port 3000 --log-dir ./logs
chmod u+x
one-api
./
one-api
--port 3000 --log-dir ./logs
```
3. Visit [http://localhost:3000/](http://localhost:3000/) and login. The username for the initial account is `
root
` and the password is `
123456
`.
### Deploy with Docker
Execute: `
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/
gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template
`
Execute: `
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/
one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api
`
Data will be saved in `
/home/ubuntu/data/
gin-template
`.
Data will be saved in `
/home/ubuntu/data/
one-api
`.
## Configurations
The system works out of the box.
...
...
@@ -85,7 +85,7 @@ After the system starts, use `root` user to log in to the system and do further
2. `
SESSION_SECRET
`: when set, a fixed session key will be used so that the logged-in users' cookie remains valid across system reboots.
+ Example: `
SESSION_SECRET=random_string
`
3. `
SQL_DSN
`: when set, the target SQL database will be used instead of SQLite.
+ Example: `
SQL_DSN=root:123456@tcp(localhost:3306)/
gin-template
`
+ Example: `
SQL_DSN=root:123456@tcp(localhost:3306)/
one-api
`
### Command line Arguments
1. `
--port
<port
_number
>
`: specify the port number, the default value is `
3000
`.
...
...
README.md
View file @
483bd64d
...
...
@@ -3,40 +3,40 @@
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/
gin-template"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/gin-template/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"gin-template
logo"
></a>
<a
href=
"https://github.com/songquanpeng/
one-api"
><img
src=
"https://raw.githubusercontent.com/songquanpeng/one-api/main/web/public/logo.png"
width=
"150"
height=
"150"
alt=
"one-api
logo"
></a>
</p>
<div
align=
"center"
>
# Gin
项目模板
# Gin
One API
_✨ 用于 Gin & React 项目的模板 ✨_
</div>
<p
align=
"center"
>
<a
href=
"https://raw.githubusercontent.com/songquanpeng/
gin-template
/main/LICENSE"
>
<img
src=
"https://img.shields.io/github/license/songquanpeng/
gin-template
?color=brightgreen"
alt=
"license"
>
<a
href=
"https://raw.githubusercontent.com/songquanpeng/
one-api
/main/LICENSE"
>
<img
src=
"https://img.shields.io/github/license/songquanpeng/
one-api
?color=brightgreen"
alt=
"license"
>
</a>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases/latest"
>
<img
src=
"https://img.shields.io/github/v/release/songquanpeng/
gin-template
?color=brightgreen&include_prereleases"
alt=
"release"
>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases/latest"
>
<img
src=
"https://img.shields.io/github/v/release/songquanpeng/
one-api
?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases/latest"
>
<img
src=
"https://img.shields.io/github/downloads/songquanpeng/
gin-template
/total?color=brightgreen&include_prereleases"
alt=
"release"
>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases/latest"
>
<img
src=
"https://img.shields.io/github/downloads/songquanpeng/
one-api
/total?color=brightgreen&include_prereleases"
alt=
"release"
>
</a>
<a
href=
"https://goreportcard.com/report/github.com/songquanpeng/
gin-template
"
>
<img
src=
"https://goreportcard.com/badge/github.com/songquanpeng/
gin-template
"
alt=
"GoReportCard"
>
<a
href=
"https://goreportcard.com/report/github.com/songquanpeng/
one-api
"
>
<img
src=
"https://goreportcard.com/badge/github.com/songquanpeng/
one-api
"
alt=
"GoReportCard"
>
</a>
</p>
<p
align=
"center"
>
<a
href=
"https://github.com/songquanpeng/
gin-template
/releases"
>
程序下载
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
/releases"
>
程序下载
</a>
·
<a
href=
"https://github.com/songquanpeng/
gin-template
#部署"
>
部署教程
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
#部署"
>
部署教程
</a>
·
<a
href=
"https://github.com/songquanpeng/
gin-template
/issues"
>
意见反馈
</a>
<a
href=
"https://github.com/songquanpeng/
one-api
/issues"
>
意见反馈
</a>
·
<a
href=
"https://
gin-template
.vercel.app/"
>
在线演示
</a>
<a
href=
"https://
one-api
.vercel.app/"
>
在线演示
</a>
</p>
## 功能
...
...
@@ -54,25 +54,25 @@ _✨ 用于 Gin & React 项目的模板 ✨_
## 部署
### 手动部署
1.
从
[
GitHub Releases
](
https://github.com/songquanpeng/
gin-template
/releases/latest
)
下载可执行文件或者从源码编译:
1.
从
[
GitHub Releases
](
https://github.com/songquanpeng/
one-api
/releases/latest
)
下载可执行文件或者从源码编译:
```shell
git clone https://github.com/songquanpeng/
gin-template
.git
git clone https://github.com/songquanpeng/
one-api
.git
go mod download
go build -ldflags "-s -w" -o
gin-template
go build -ldflags "-s -w" -o
one-api
````
2. 运行:
```shell
chmod u+x
gin-template
./
gin-template
--port 3000 --log-dir ./logs
chmod u+x
one-api
./
one-api
--port 3000 --log-dir ./logs
```
3. 访问 [http://localhost:3000/](http://localhost:3000/) 并登录。初始账号用户名为 `
root
`,密码为 `
123456
`。
更加详细的部署教程[参见此处](https://iamazing.cn/page/how-to-deploy-a-website)。
### 基于 Docker 进行部署
执行:`
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/
gin-template:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/gin-template
`
执行:`
docker run -d --restart always -p 3000:3000 -v /home/ubuntu/data/
one-api:/data -v /etc/ssl/certs:/etc/ssl/certs:ro justsong/one-api
`
数据将会保存在宿主机的 `
/home/ubuntu/data/
gin-template
` 目录。
数据将会保存在宿主机的 `
/home/ubuntu/data/
one-api
` 目录。
## 配置
系统本身开箱即用。
...
...
@@ -87,7 +87,7 @@ _✨ 用于 Gin & React 项目的模板 ✨_
2. `
SESSION_SECRET
`:设置之后将使用固定的会话密钥,这样系统重新启动后已登录用户的 cookie 将依旧有效。
+ 例子:`
SESSION_SECRET=random_string
`
3. `
SQL_DSN
`:设置之后将使用指定数据库而非 SQLite。
+ 例子:`
SQL_DSN=root:123456@tcp(localhost:3306)/
gin-template
`
+ 例子:`
SQL_DSN=root:123456@tcp(localhost:3306)/
one-api
`
### 命令行参数
1. `
--port
<port
_number
>
`: 指定服务器监听的端口号,默认为 `
3000
`。
...
...
common/constants.go
View file @
483bd64d
...
...
@@ -8,14 +8,14 @@ import (
var
StartTime
=
time
.
Now
()
.
Unix
()
// unit: second
var
Version
=
"v0.0.0"
// this hard coding will be replaced automatically when building, no need to manually change
var
SystemName
=
"
项目模板
"
var
SystemName
=
"
One API
"
var
ServerAddress
=
"http://localhost:3000"
var
Footer
=
""
// Any options with "Secret", "Token" in its key won't be return by GetOptions
var
SessionSecret
=
uuid
.
New
()
.
String
()
var
SQLitePath
=
"
gin-template
.db"
var
SQLitePath
=
"
one-api
.db"
var
OptionMap
map
[
string
]
string
var
OptionMapRWMutex
sync
.
RWMutex
...
...
controller/file.go
View file @
483bd64d
...
...
@@ -2,10 +2,10 @@ package controller
import
(
"fmt"
"gin-template/common"
"gin-template/model"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
"path/filepath"
"strconv"
"strings"
...
...
controller/github.go
View file @
483bd64d
...
...
@@ -5,11 +5,11 @@ import (
"encoding/json"
"errors"
"fmt"
"gin-template/common"
"gin-template/model"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
"strconv"
"time"
)
...
...
controller/misc.go
View file @
483bd64d
...
...
@@ -3,10 +3,10 @@ package controller
import
(
"encoding/json"
"fmt"
"gin-template/common"
"gin-template/model"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
)
func
GetStatus
(
c
*
gin
.
Context
)
{
...
...
controller/option.go
View file @
483bd64d
...
...
@@ -2,10 +2,10 @@ package controller
import
(
"encoding/json"
"gin-template/common"
"gin-template/model"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
"strings"
)
...
...
controller/user.go
View file @
483bd64d
...
...
@@ -2,12 +2,12 @@ package controller
import
(
"encoding/json"
"gin-template/common"
"gin-template/model"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"net/http"
"one-api/common"
"one-api/model"
"strconv"
"strings"
)
...
...
controller/wechat.go
View file @
483bd64d
...
...
@@ -4,10 +4,10 @@ import (
"encoding/json"
"errors"
"fmt"
"gin-template/common"
"gin-template/model"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
"strconv"
"time"
)
...
...
go.mod
View file @
483bd64d
module
gin-template
module
one-api
// +heroku goVersion go1.18
go 1.18
...
...
main.go
View file @
483bd64d
...
...
@@ -2,16 +2,16 @@ package main
import
(
"embed"
"gin-template/common"
"gin-template/middleware"
"gin-template/model"
"gin-template/router"
"github.com/gin-contrib/gzip"
"github.com/gin-contrib/sessions"
"github.com/gin-contrib/sessions/cookie"
"github.com/gin-contrib/sessions/redis"
"github.com/gin-gonic/gin"
"log"
"one-api/common"
"one-api/middleware"
"one-api/model"
"one-api/router"
"os"
"strconv"
)
...
...
middleware/auth.go
View file @
483bd64d
package
middleware
import
(
"gin-template/common"
"gin-template/model"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/model"
)
func
authHelper
(
c
*
gin
.
Context
,
minRole
int
)
{
...
...
middleware/cors.go
View file @
483bd64d
...
...
@@ -7,6 +7,6 @@ import (
func
CORS
()
gin
.
HandlerFunc
{
config
:=
cors
.
DefaultConfig
()
config
.
AllowOrigins
=
[]
string
{
"https://
gin-template
.vercel.app"
,
"http://localhost:3000/"
}
config
.
AllowOrigins
=
[]
string
{
"https://
one-api
.vercel.app"
,
"http://localhost:3000/"
}
return
cors
.
New
(
config
)
}
middleware/rate-limit.go
View file @
483bd64d
...
...
@@ -3,9 +3,9 @@ package middleware
import
(
"context"
"fmt"
"gin-template/common"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"time"
)
...
...
middleware/turnstile-check.go
View file @
483bd64d
...
...
@@ -2,11 +2,11 @@ package middleware
import
(
"encoding/json"
"gin-template/common"
"github.com/gin-contrib/sessions"
"github.com/gin-gonic/gin"
"net/http"
"net/url"
"one-api/common"
)
type
turnstileCheckResponse
struct
{
...
...
model/file.go
View file @
483bd64d
package
model
import
(
"gin-template/common"
_
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"one-api/common"
"os"
"path"
)
...
...
model/main.go
View file @
483bd64d
package
model
import
(
"gin-template/common"
"gorm.io/driver/mysql"
"gorm.io/driver/sqlite"
"gorm.io/gorm"
"one-api/common"
"os"
)
...
...
model/option.go
View file @
483bd64d
package
model
import
(
"
gin-template
/common"
"
one-api
/common"
"strconv"
"strings"
)
...
...
model/user.go
View file @
483bd64d
...
...
@@ -2,7 +2,7 @@ package model
import
(
"errors"
"
gin-template
/common"
"
one-api
/common"
"strings"
)
...
...
router/api-router.go
View file @
483bd64d
package
router
import
(
"gin-template/controller"
"gin-template/middleware"
"github.com/gin-gonic/gin"
"one-api/controller"
"one-api/middleware"
)
func
SetApiRouter
(
router
*
gin
.
Engine
)
{
...
...
router/web-router.go
View file @
483bd64d
...
...
@@ -2,12 +2,12 @@ package router
import
(
"embed"
"gin-template/common"
"gin-template/controller"
"gin-template/middleware"
"github.com/gin-contrib/static"
"github.com/gin-gonic/gin"
"net/http"
"one-api/common"
"one-api/controller"
"one-api/middleware"
)
func
setWebRouter
(
router
*
gin
.
Engine
,
buildFS
embed
.
FS
,
indexPage
[]
byte
)
{
...
...
web/public/favicon.ico
View file @
483bd64d
No preview for this file type
web/public/index.html
View file @
483bd64d
...
...
@@ -9,7 +9,7 @@
name=
"description"
content=
"Web site created using create-react-app"
/>
<title>
项目模板
</title>
<title>
One API
</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
...
...
web/public/logo.png
View file @
483bd64d
5.22 KB
|
W:
|
H:
7.9 KB
|
W:
|
H:
2-up
Swipe
Onion skin
web/src/components/Footer.js
View file @
483bd64d
...
...
@@ -16,10 +16,10 @@ const Footer = () => {
{
Footer
===
''
?
(
<
div
className
=
"custom-footer"
>
<
a
href
=
"https://github.com/songquanpeng/
gin-template
"
href
=
"https://github.com/songquanpeng/
one-api
"
target
=
"_blank"
>
项目模板
{
process
.
env
.
REACT_APP_VERSION
}{
' '
}
One
API
{
process
.
env
.
REACT_APP_VERSION
}{
' '
}
<
/a
>
由
{
' '
}
<
a
href
=
"https://github.com/songquanpeng"
target
=
"_blank"
>
...
...
web/src/components/Header.js
View file @
483bd64d
...
...
@@ -105,7 +105,7 @@ const Header = () => {
style
=
{{
marginRight
:
'0.75em'
}}
/
>
<
div
style
=
{{
fontSize
:
'20px'
}}
>
<
b
>
项目模板
<
/b
>
<
b
>
One
API
<
/b
>
<
/div
>
<
/Menu.Item
>
<
Menu
.
Menu
position
=
'right'
>
...
...
@@ -159,7 +159,7 @@ const Header = () => {
<
Menu
.
Item
as
=
{
Link
}
to
=
'/'
className
=
{
'hide-on-mobile'
}
>
<
img
src
=
'/logo.png'
alt
=
'logo'
style
=
{{
marginRight
:
'0.75em'
}}
/
>
<
div
style
=
{{
fontSize
:
'20px'
}}
>
<
b
>
项目模板
<
/b
>
<
b
>
One
API
<
/b
>
<
/div
>
<
/Menu.Item
>
{
renderButtons
(
false
)}
...
...
web/src/components/LoginForm.js
View file @
483bd64d
...
...
@@ -90,7 +90,7 @@ const LoginForm = () => {
return
(
<
Grid
textAlign
=
"center"
style
=
{{
marginTop
:
'48px'
}}
>
<
Grid
.
Column
style
=
{{
maxWidth
:
450
}}
>
<
Header
as
=
"h2"
color
=
"
teal
"
textAlign
=
"center"
>
<
Header
as
=
"h2"
color
=
""
textAlign
=
"center"
>
<
Image
src
=
"/logo.png"
/>
用户登录
<
/Header
>
<
Form
size
=
"large"
>
...
...
@@ -114,7 +114,7 @@ const LoginForm = () => {
value
=
{
password
}
onChange
=
{
handleChange
}
/
>
<
Button
color
=
"
teal
"
fluid
size
=
"large"
onClick
=
{
handleSubmit
}
>
<
Button
color
=
""
fluid
size
=
"large"
onClick
=
{
handleSubmit
}
>
登录
<
/Button
>
<
/Segment
>
...
...
@@ -179,7 +179,7 @@ const LoginForm = () => {
onChange
=
{
handleChange
}
/
>
<
Button
color
=
"
teal
"
color
=
""
fluid
size
=
"large"
onClick
=
{
onSubmitWeChatVerificationCode
}
...
...
web/src/components/OtherSetting.js
View file @
483bd64d
...
...
@@ -71,12 +71,12 @@ const OtherSetting = () => {
const
openGitHubRelease
=
()
=>
{
window
.
location
=
'https://github.com/songquanpeng/
gin-template
/releases/latest'
;
'https://github.com/songquanpeng/
one-api
/releases/latest'
;
};
const
checkUpdate
=
async
()
=>
{
const
res
=
await
API
.
get
(
'https://api.github.com/repos/songquanpeng/
gin-template
/releases/latest'
'https://api.github.com/repos/songquanpeng/
one-api
/releases/latest'
);
const
{
tag_name
,
body
}
=
res
.
data
;
if
(
tag_name
===
process
.
env
.
REACT_APP_VERSION
)
{
...
...
web/src/components/PasswordResetConfirm.js
View file @
483bd64d
...
...
@@ -43,7 +43,7 @@ const PasswordResetConfirm = () => {
return
(
<
Grid
textAlign
=
'center'
style
=
{{
marginTop
:
'48px'
}}
>
<
Grid
.
Column
style
=
{{
maxWidth
:
450
}}
>
<
Header
as
=
'h2'
color
=
'
teal
'
textAlign
=
'center'
>
<
Header
as
=
'h2'
color
=
''
textAlign
=
'center'
>
<
Image
src
=
'/logo.png'
/>
密码重置确认
<
/Header
>
<
Form
size
=
'large'
>
...
...
@@ -58,7 +58,7 @@ const PasswordResetConfirm = () => {
readOnly
/>
<
Button
color
=
'
teal
'
color
=
''
fluid
size
=
'large'
onClick
=
{
handleSubmit
}
...
...
web/src/components/PasswordResetForm.js
View file @
483bd64d
...
...
@@ -53,7 +53,7 @@ const PasswordResetForm = () => {
return
(
<
Grid
textAlign
=
'center'
style
=
{{
marginTop
:
'48px'
}}
>
<
Grid
.
Column
style
=
{{
maxWidth
:
450
}}
>
<
Header
as
=
'h2'
color
=
'
teal
'
textAlign
=
'center'
>
<
Header
as
=
'h2'
color
=
''
textAlign
=
'center'
>
<
Image
src
=
'/logo.png'
/>
密码重置
<
/Header
>
<
Form
size
=
'large'
>
...
...
@@ -78,7 +78,7 @@ const PasswordResetForm = () => {
<><
/
>
)}
<
Button
color
=
'
teal
'
color
=
''
fluid
size
=
'large'
onClick
=
{
handleSubmit
}
...
...
web/src/components/PersonalSetting.js
View file @
483bd64d
...
...
@@ -138,7 +138,7 @@ const PersonalSetting = () => {
value
=
{
inputs
.
wechat_verification_code
}
onChange
=
{
handleInputChange
}
/
>
<
Button
color
=
'
teal
'
fluid
size
=
'large'
onClick
=
{
bindWeChat
}
>
<
Button
color
=
''
fluid
size
=
'large'
onClick
=
{
bindWeChat
}
>
绑定
<
/Button
>
<
/Form
>
...
...
@@ -194,7 +194,7 @@ const PersonalSetting = () => {
<><
/
>
)}
<
Button
color
=
'
teal
'
color
=
''
fluid
size
=
'large'
onClick
=
{
bindEmail
}
...
...
web/src/components/RegisterForm.js
View file @
483bd64d
...
...
@@ -99,7 +99,7 @@ const RegisterForm = () => {
return
(
<
Grid
textAlign
=
'center'
style
=
{{
marginTop
:
'48px'
}}
>
<
Grid
.
Column
style
=
{{
maxWidth
:
450
}}
>
<
Header
as
=
'h2'
color
=
'
teal
'
textAlign
=
'center'
>
<
Header
as
=
'h2'
color
=
''
textAlign
=
'center'
>
<
Image
src
=
'/logo.png'
/>
新用户注册
<
/Header
>
<
Form
size
=
'large'
>
...
...
@@ -169,7 +169,7 @@ const RegisterForm = () => {
<><
/
>
)}
<
Button
color
=
'
teal
'
color
=
''
fluid
size
=
'large'
onClick
=
{
handleSubmit
}
...
...
web/src/pages/About/index.js
View file @
483bd64d
...
...
@@ -31,8 +31,8 @@ const About = () => {
<
Header
as
=
'h3'
>
关于
<
/Header
>
<
p
>
可在设置页面设置关于内容,支持
HTML
&
Markdown
<
/p
>
项目仓库地址:
<
a
href
=
"https://github.com/songquanpeng/
gin-template
"
>
https
:
//github.com/songquanpeng/
gin-template
<
a
href
=
"https://github.com/songquanpeng/
one-api
"
>
https
:
//github.com/songquanpeng/
one-api
<
/a
>
<
/> : <
>
<
div
dangerouslySetInnerHTML
=
{{
__html
:
about
}}
><
/div
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment