Skip to content

Commit 5274816

Browse files
committed
refactor: add cookie.ts to lib/vscode
1 parent 5e95261 commit 5274816

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export enum Cookie {
2+
Key = "key",
3+
}

lib/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
3939
import { IsWebContext } from 'vs/platform/contextkey/common/contextkeys';
4040
import { ICommandService } from 'vs/platform/commands/common/commands';
4141
import { ILogService } from 'vs/platform/log/common/log';
42+
import { Cookie } from 'vs/server/common/cookie';
4243

4344
export abstract class MenubarControl extends Disposable {
4445

@@ -723,7 +724,7 @@ export class CustomMenubarControl extends MenubarControl {
723724

724725
webNavigationActions.push(new Action('logout', nls.localize('logout', "Log out"), undefined, true,
725726
async (event?: MouseEvent) => {
726-
const COOKIE_KEY = 'key';
727+
const COOKIE_KEY = Cookie.Key;
727728
const loginCookie = DOM.getCookieValue(COOKIE_KEY);
728729

729730
this.logService.info('Logging out of code-server');

src/node/routes/login.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@ import { promises as fs } from "fs"
33
import { RateLimiter as Limiter } from "limiter"
44
import * as path from "path"
55
import safeCompare from "safe-compare"
6+
import { Cookie } from "../../../lib/vscode/src/vs/server/common/cookie"
67
import { rootPath } from "../constants"
78
import { authenticated, getCookieDomain, redirect, replaceTemplates } from "../http"
89
import { hash, humanPath } from "../util"
910

10-
export enum Cookie {
11-
Key = "key",
12-
}
13-
1411
// RateLimiter wraps around the limiter library for logins.
1512
// It allows 2 logins every minute and 12 logins every hour.
1613
class RateLimiter {

0 commit comments

Comments
 (0)