fix: CJK user name not allowed in request header

And nanoid in header will be low cased, so do it on my side

This fix requires https://github.com/Jermolene/TiddlyWiki5/pull/7471 to be merged to work
This commit is contained in:
lin onetwo 2023-05-22 01:08:12 +08:00
parent be05c33bfa
commit d24a7519f2
2 changed files with 2 additions and 2 deletions

View file

@ -110,7 +110,7 @@ export class Authentication implements IAuthenticationService {
}
public generateOneTimeAdminAuthTokenForWorkspace(workspaceID: string): string {
const newToken = nanoid();
const newToken = nanoid().toLowerCase();
this.oneTimeAdminAuthToken.set(workspaceID, newToken);
return newToken;
}

View file

@ -65,7 +65,7 @@ function assignAdminAuthToken(workspaceID: string, details: Electron.OnBeforeSen
logger.error(`adminToken is undefined for ${workspaceID}, this should not happen. Skip adding ${TIDGI_AUTH_TOKEN_HEADER}-xxx header for it.`);
return;
}
details.requestHeaders[getTidGiAuthHeaderWithToken(adminToken)] = viewContext.userName;
details.requestHeaders[getTidGiAuthHeaderWithToken(adminToken)] = encodeURIComponent(viewContext.userName);
}
function handleFileProtocol(sessionOfView: Electron.Session, nativeService: INativeService) {