Skip to content

Commit

Permalink
4.8.5 perf app ui (labring#1845)
Browse files Browse the repository at this point in the history
* list ui and layout

* rename token key

* app ui

* ssr
  • Loading branch information
c121914yu committed Jun 25, 2024
1 parent c8bc983 commit 9aa6fd4
Show file tree
Hide file tree
Showing 15 changed files with 10,490 additions and 8,318 deletions.
3 changes: 2 additions & 1 deletion packages/service/common/vectorStore/pg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const connectPg = async (): Promise<Pool> => {
});

global.pgClient.on('error', async (err) => {
console.log(err);
addLog.error(`pg error`, err);
global.pgClient?.end();
global.pgClient = null;

Expand All @@ -36,6 +36,7 @@ export const connectPg = async (): Promise<Pool> => {
console.log('pg connected');
return global.pgClient;
} catch (error) {
addLog.error(`pg connect error`, error);
global.pgClient?.end();
global.pgClient = null;

Expand Down
10 changes: 7 additions & 3 deletions packages/service/support/permission/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export async function parseHeaderCert({
async function authCookieToken(cookie?: string, token?: string) {
// 获取 cookie
const cookies = Cookie.parse(cookie || '');
const cookieToken = token || cookies.token;
const cookieToken = token || cookies[TokenName];

if (!cookieToken) {
return Promise.reject(ERROR_ENUM.unAuthorization);
Expand Down Expand Up @@ -198,12 +198,16 @@ export async function parseHeaderCert({
}

/* set cookie */
export const TokenName = 'fastgpt_token';
export const setCookie = (res: NextApiResponse, token: string) => {
res.setHeader('Set-Cookie', `token=${token}; Path=/; HttpOnly; Max-Age=604800; Samesite=Strict;`);
res.setHeader(
'Set-Cookie',
`${TokenName}=${token}; Path=/; HttpOnly; Max-Age=604800; Samesite=Strict;`
);
};
/* clear cookie */
export const clearCookie = (res: NextApiResponse) => {
res.setHeader('Set-Cookie', 'token=; Path=/; Max-Age=0');
res.setHeader('Set-Cookie', `${TokenName}=; Path=/; Max-Age=0`);
};

/* file permission */
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9aa6fd4

Please sign in to comment.