This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
2,202 additions
and
2,188 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# EditorConfig is awesome: https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = tab | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = true | ||
|
||
[*.yml] | ||
indent_style = space |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
export function catch_error(err, req, res, next) { | ||
console.error(err) | ||
res.json({ message: err.message }) | ||
console.error(err) | ||
res.json({ message: err.message }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import axios from 'axios' | ||
|
||
export async function get_access_token(req, res) { | ||
const { email, password } = req.body | ||
if (!email || !password) { | ||
throw new Error('invalid [email] or [password]') | ||
} | ||
// 如果需要自建auth服务, 请fork: https://github.com/zhuweiyou/chatgpt-auth | ||
const { data } = await axios({ | ||
method: 'POST', | ||
url: 'https://chatgpt-auth.vercel.app/', | ||
headers: { | ||
'X-Email': email, | ||
'X-Password': password, | ||
}, | ||
}) | ||
if (!data) { | ||
throw new Error('failed to get [access_token]') | ||
} | ||
res.json({ access_token: data }) | ||
const { email, password } = req.body | ||
if (!email || !password) { | ||
throw new Error('invalid [email] or [password]') | ||
} | ||
// 如果需要自建auth服务, 请fork: https://github.com/zhuweiyou/chatgpt-auth | ||
const { data } = await axios({ | ||
method: 'POST', | ||
url: 'https://chatgpt-auth.vercel.app/', | ||
headers: { | ||
'X-Email': email, | ||
'X-Password': password, | ||
}, | ||
}) | ||
if (!data) { | ||
throw new Error('failed to get [access_token]') | ||
} | ||
res.json({ access_token: data }) | ||
} |
Oops, something went wrong.