Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ver. 2.3 with backend ver. 2.1 #31

Merged
merged 31 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
4913015
[*] 适配后端标准化返回
Muska-Ami Sep 20, 2024
5ccf056
Remove unnecessary code
Muska-Ami Sep 20, 2024
7121cdb
[*] 同步更改
Muska-Ami Sep 21, 2024
f42fa65
返回兼容
Muska-Ami Sep 22, 2024
90c0902
[*] 重新适配后端 API (未修改调用)
Muska-Ami Sep 25, 2024
f5a62fc
[*] 重写了部分调用,修正一些 API
Muska-Ami Sep 25, 2024
490fccf
[*] 修改 UserInfo 喝 SignView API 调用
Muska-Ami Sep 25, 2024
8a512ee
[*] 进一步适配新版 API
Muska-Ami Sep 25, 2024
5beb43c
[*] 删除 API 后端密码校验
Muska-Ami Sep 25, 2024
7e5e405
移除 OAuth 登录,移除前端传递的部分参数
Muska-Ami Sep 27, 2024
8b39bfc
修改 QQ 登录调用
Muska-Ami Sep 27, 2024
1c10761
QQ 登录回调界面
Muska-Ami Sep 27, 2024
938b56c
[*] 添加两个路由
Muska-Ami Sep 27, 2024
51dfbd4
[*] 修复错误调用
Muska-Ami Sep 27, 2024
ea2457b
[*] 格式化代码
Muska-Ami Sep 27, 2024
69e6aa9
[*] 回调界面
Muska-Ami Sep 27, 2024
fad66e5
[-] 去除多余依赖
Muska-Ami Sep 27, 2024
92e8590
[*] 修复构建
Muska-Ami Sep 27, 2024
be17e21
[*] 修复构建
Muska-Ami Sep 27, 2024
6c57e74
[*] 适配后端更改
Muska-Ami Sep 28, 2024
0ab5434
[*] 预览版
Muska-Ami Sep 29, 2024
df2f9dc
[*] 添加后端域名
Muska-Ami Sep 29, 2024
583a80e
Merge pull request #32 from LoCyan-Team/master
Muska-Ami Sep 29, 2024
141824e
[*] 修改一个界面展示
Muska-Ami Sep 29, 2024
0ccb7b0
Merge branch 'dev-newapi' of https://github.com/LoCyan-Team/LoCyanFrp…
Muska-Ami Sep 29, 2024
cc3b8b8
[*] 修改通知展示
Muska-Ami Sep 29, 2024
c10aeff
[+] Minecraft 联机
Muska-Ami Sep 29, 2024
3119571
[*] 修改 ICP 备案界面
Muska-Ami Sep 29, 2024
b40bb5b
Update package.json
Muska-Ami Sep 29, 2024
6988203
[-] Remove dead code
Muska-Ami Sep 30, 2024
7882869
Merge branch 'dev-newapi' of https://github.com/LoCyan-Team/LoCyanFrp…
Muska-Ami Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@
</template>
<script setup>
import { ref, onMounted } from 'vue'
import { sendErrorMessage } from '@/utils/message'
import api from '@/api'
import logger from '@/utils/logger'
import { sendErrorMessage } from '@/utils/message.js'
import api from '@/api/index.js'
import logger from '@/utils/logger.js'

const show = ref(true)
const file_name = ref('')
Expand Down
2 changes: 1 addition & 1 deletion _deprecated/LanLobby.vue
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ function getPrivateLobby() {

function getProxyList() {
const rs = get(
'https://api-v2.locyanfrp.cn/api/v2/proxies/getlist?username=' +
'https://api-v2.locyanfrp.cn/api/v2/proxies/list?username=' +
localStorage.getItem('username')
)
rs.then((res) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "locyanfrp",
"private": true,
"version": "2.2",
"version": "2.3",
"type": "module",
"scripts": {
"dev": "vite",
Expand Down
2 changes: 1 addition & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ setInterval(async () => {
if (userData.getters.get_token) {
let rs
try {
rs = await api.v2.users.info(userData.getters.get_username)
rs = await api.v2.user.info.root.get(userData.getters.get_username)
} catch (e) {
sendWarningMessage('查询用户信息失败: ' + e + ',请重新登录后台!')
logout()
Expand Down
7 changes: 4 additions & 3 deletions src/api/base.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
const base = {
api_v1_url: 'https://api.locyanfrp.cn',
api_v2_url: 'https://api-v2.locyanfrp.cn/api/v2',
api_v2_url: 'https://api-v2-next.locyanfrp.cn/api/v2',
// api_v2_url: 'http://localhost:18080/api/v2',
buildResponse: (res: any, useDataPath: boolean = true) => {
const message =
res.data?.data?.message ??
res.data?.data?.msg ??
res.data?.message ??
res.response?.data?.message ??
res.data?.msg ??
res.response?.data?.msg ??
'未指定或请求失败'
const data = (useDataPath ? res.data?.data : res.data) ?? {}
const statusApi = useDataPath ? res.data?.status : res.status
Expand Down
9 changes: 9 additions & 0 deletions src/api/v2/auth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import login from './login.api'
import oauth from './oauth'
import register from './register.api'

export default {
login: login,
register: register,
oauth: oauth
}
2 changes: 1 addition & 1 deletion src/api/v2/users/login.ts → src/api/v2/auth/login.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { post } from '@/utils/request'
import base from '@/api/base'

const login = async (username: string, password: string) => {
const rs = post(`${base.api_v2_url}/users/login`, {
const rs = post(`${base.api_v2_url}/auth/login`, {
username: username,
password: password
})
Expand Down
5 changes: 5 additions & 0 deletions src/api/v2/auth/oauth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import qq from './qq'

export default {
qq: qq
}
33 changes: 33 additions & 0 deletions src/api/v2/auth/oauth/qq/bind.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import base from '@/api/base'
//@ts-ignore
import { get, post, deleteReq } from '@/utils/request'

const getBind = async (username: string) => {
const rs = await get(`${base.api_v2_url}/auth/oauth/qq/bind`, {
username: username
})
return base.buildResponse(rs)
}

const postBind = async (username: string, code: string) => {
const rs = await post(`${base.api_v2_url}/auth/oauth/qq/bind`, {
username: username,
code: code
})
return base.buildResponse(rs)
}

const deleteBind = async (username: string) => {
const rs = await deleteReq(`${base.api_v2_url}/auth/oauth/qq/bind`, {
username: username
})
return base.buildResponse(rs)
}

const bind = {
get: getBind,
post: postBind,
delete: deleteBind
}

export default bind
7 changes: 7 additions & 0 deletions src/api/v2/auth/oauth/qq/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import bind from './bind.api'
import login from './login.api'

export default {
login: login,
bind: bind
}
22 changes: 22 additions & 0 deletions src/api/v2/auth/oauth/qq/login.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import base from '@/api/base'
//@ts-ignore
import { get, post } from '@/utils/request'

const getLogin = async () => {
const rs = await get(`${base.api_v2_url}/auth/oauth/qq/login`)
return base.buildResponse(rs)
}

const postLogin = async (code: string) => {
const rs = await post(`${base.api_v2_url}/auth/oauth/qq/login`, {
code: code
})
return base.buildResponse(rs)
}

const login = {
get: getLogin,
post: postLogin
}

export default login
12 changes: 5 additions & 7 deletions src/api/v2/users/register.ts → src/api/v2/auth/register.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@ import base from '@/api/base'
const register = async (
username: string,
password: string,
confirm_password: string,
email: string,
verify: number,
qq: number
verify_code: number,
qq_code: number
) => {
const rs = post(`${base.api_v2_url}/users/register`, {
const rs = post(`${base.api_v2_url}/auth/register`, {
username: username,
password: password,
confirm_password: confirm_password,
email: email,
verify: verify,
qq: qq
verify_code: verify_code,
qq_code: qq_code
})
return base.buildResponse(await rs)
}
Expand Down
15 changes: 0 additions & 15 deletions src/api/v2/config/get.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/api/v2/config/index.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/api/v2/donate/create.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/api/v2/donate/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import create from './create'
import list from './list'
import root from './root.api'
import list from './list.api'

export default {
list: list,
create: create
root: root,
list: list
}
File renamed without changes.
20 changes: 20 additions & 0 deletions src/api/v2/donate/root.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import base from '@/api/base'
//@ts-ignore
import { post } from '@/utils/request'

/**
* 创建赞助订单
*/
const postDonate = async (username: string, money: string) => {
const rs = post(`${base.api_v2_url}/donate`, {
username: username,
money: money
})
return base.buildResponse(await rs)
}

const root = {
post: postDonate
}

export default root
5 changes: 5 additions & 0 deletions src/api/v2/email/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import register from './register.api'

export default {
register: register
}
6 changes: 3 additions & 3 deletions src/api/v2/users/send.ts → src/api/v2/email/register.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import { get } from '@/utils/request'
import base from '@/api/base'

const send = async (email: string) => {
const rs = get(`${base.api_v2_url}/users/send`, {
const register = async (email: string) => {
const rs = get(`${base.api_v2_url}/email/register`, {
email: email
})
return base.buildResponse(await rs)
}

export default send
export default register
40 changes: 40 additions & 0 deletions src/api/v2/icp.api.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import base from '@/api/base'
//@ts-ignore
import { get, post, deleteReq } from '@/utils/request'

/**
* 审核 ICP 备案域名
*/
const postIcp = async (username: string, domain: string) => {
const rs = post(`${base.api_v2_url}/icp`, {
username: username,
domain: domain
})
return base.buildResponse(await rs)
}

const deleteIcp = async (username: string, domain_id: number) => {
const rs = deleteReq(`${base.api_v2_url}/icp`, {
username: username,
id: domain_id
})
return base.buildResponse(await rs)
}

/**
* 列出已审核 ICP 备案域名
*/
const getIcp = async (username: string) => {
const rs = get(`${base.api_v2_url}/icp`, {
username: username
})
return base.buildResponse(await rs)
}

const icp = {
get: getIcp,
post: postIcp,
delete: deleteIcp
}

export default icp
17 changes: 0 additions & 17 deletions src/api/v2/icp/check.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/api/v2/icp/index.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/api/v2/icp/list.ts

This file was deleted.

14 changes: 0 additions & 14 deletions src/api/v2/icp/remove.ts

This file was deleted.

Loading