mirror of
https://github.com/coder/code-server.git
synced 2026-11-02 22:09:11 +01:00
Compare commits
4 Commits
abba93bd8e
...
6b77fe3666
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6b77fe3666 | ||
|
|
70fc911358 | ||
|
|
761b0d2a19 | ||
|
|
09012065c9 |
@@ -4,8 +4,13 @@ metadata:
|
||||
name: {{ include "code-server.fullname" . }}
|
||||
labels:
|
||||
{{- include "code-server.labels" . | nindent 4 }}
|
||||
annotations:
|
||||
{{- with .Values.service.annotations }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
loadBalancerClass: {{ .Values.service.loadBalancerClass }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
|
||||
@@ -48,6 +48,8 @@ priorityClassName: ""
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
loadBalancerClass: null
|
||||
annotations: {}
|
||||
|
||||
ingress:
|
||||
enabled: false
|
||||
|
||||
33
package-lock.json
generated
33
package-lock.json
generated
@@ -35,7 +35,7 @@
|
||||
"code-server": "out/node/entry.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.0",
|
||||
"@eslint/compat": "^2.1.1",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.12.0",
|
||||
"@types/compression": "^1.7.3",
|
||||
@@ -170,19 +170,19 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/compat": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-1.4.1.tgz",
|
||||
"integrity": "sha512-cfO82V9zxxGBxcQDr1lfaYB7wykTa0b00mGa36FrJl7iTFd0Z2cHfEYuxcBRP/iNijCsWsEkA+jzT8hGYmv33w==",
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/compat/-/compat-2.1.1.tgz",
|
||||
"integrity": "sha512-rMcy8GSrwNzcISX/BlTDY/GLB4eCopEuy9woIls3To+15OLxykZrxxq+WUcylCPCQ6F4MujjBM1DX5V1aqI3Vw==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@eslint/core": "^0.17.0"
|
||||
"@eslint/core": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
"node": "^20.19.0 || ^22.13.0 || >=24"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"eslint": "^8.40 || 9"
|
||||
"eslint": "^8.40 || 9 || 10"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"eslint": {
|
||||
@@ -190,6 +190,19 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/compat/node_modules/@eslint/core": {
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz",
|
||||
"integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@types/json-schema": "^7.0.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^20.19.0 || ^22.13.0 || >=24"
|
||||
}
|
||||
},
|
||||
"node_modules/@eslint/config-array": {
|
||||
"version": "0.21.1",
|
||||
"resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.1.tgz",
|
||||
@@ -1726,9 +1739,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/basic-ftp": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-5.3.1.tgz",
|
||||
"integrity": "sha512-bopVNp6ugyA150DDuZfPFdt1KZ5a94ZDiwX4hMgZDzF+GttD80lEy8kj98kbyhLXnPvhtIo93mdnLIjpCAeeOw==",
|
||||
"version": "6.2.3",
|
||||
"resolved": "https://registry.npmjs.org/basic-ftp/-/basic-ftp-6.2.3.tgz",
|
||||
"integrity": "sha512-T7GYtQ2eKJUN5YORG7A8u2WfB9JMN0a4/wl3MI64qq2qTRfa3FXzoNq0DDojZDkDyStcL+TkfKsz4JHEZx5kGQ==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
},
|
||||
"main": "out/node/entry.js",
|
||||
"devDependencies": {
|
||||
"@eslint/compat": "^1.2.0",
|
||||
"@eslint/compat": "^2.1.1",
|
||||
"@eslint/eslintrc": "^3.1.0",
|
||||
"@eslint/js": "^9.12.0",
|
||||
"@types/compression": "^1.7.3",
|
||||
@@ -90,6 +90,9 @@
|
||||
"resolutions": {
|
||||
"@types/node": "24.x"
|
||||
},
|
||||
"overrides": {
|
||||
"basic-ftp": "^6.2.1"
|
||||
},
|
||||
"bin": {
|
||||
"code-server": "out/node/entry.js"
|
||||
},
|
||||
|
||||
@@ -235,7 +235,16 @@ export const getCookieDomain = (host: string, proxyDomains: string[]): string |
|
||||
return undefined
|
||||
}
|
||||
|
||||
proxyDomains.forEach((domain) => {
|
||||
proxyDomains.forEach((proxyDomain) => {
|
||||
// Proxy domains are patterns like `{{port}}.domain.tld` or
|
||||
// `prefix-{{port}}-suffix.domain.tld` so use the part after the label that
|
||||
// contains the port.
|
||||
const portIndex = proxyDomain.indexOf("{{port}}")
|
||||
const domain = portIndex === -1 ? proxyDomain : proxyDomain.substring(proxyDomain.indexOf(".", portIndex) + 1)
|
||||
// Skip patterns we cannot turn into a domain, like `{{port}}.{{host}}`.
|
||||
if (!domain || domain.includes("{{")) {
|
||||
return
|
||||
}
|
||||
if (host.endsWith(domain) && domain.length < host.length) {
|
||||
host = domain
|
||||
}
|
||||
|
||||
@@ -230,6 +230,35 @@ describe("http", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("getCookieDomain", () => {
|
||||
it("should use the proxy domain for the cookie", () => {
|
||||
const proxyDomains = ["{{port}}.example.com", "code-{{port}}.test.com"]
|
||||
expect(http.getCookieDomain("example.com", proxyDomains)).toBe("example.com")
|
||||
expect(http.getCookieDomain("8080.example.com", proxyDomains)).toBe("example.com")
|
||||
expect(http.getCookieDomain("8080.example.com:443", proxyDomains)).toBe("example.com")
|
||||
expect(http.getCookieDomain("code-8080.test.com", proxyDomains)).toBe("test.com")
|
||||
})
|
||||
|
||||
it("should use the highest level proxy domain", () => {
|
||||
const proxyDomains = ["{{port}}.test.example.com", "{{port}}.example.com"]
|
||||
expect(http.getCookieDomain("test.example.com", proxyDomains)).toBe("example.com")
|
||||
expect(http.getCookieDomain("8080.test.example.com", proxyDomains)).toBe("example.com")
|
||||
})
|
||||
|
||||
it("should use the host when no proxy domain matches", () => {
|
||||
expect(http.getCookieDomain("code.other.com", ["{{port}}.example.com"])).toBe("code.other.com")
|
||||
expect(http.getCookieDomain("8080.example.com", ["{{port}}.{{host}}"])).toBe("8080.example.com")
|
||||
expect(http.getCookieDomain("8080.example.com", [])).toBe("8080.example.com")
|
||||
})
|
||||
|
||||
it("should not set a domain for localhost or IP addresses", () => {
|
||||
const proxyDomains = ["{{port}}.example.com"]
|
||||
expect(http.getCookieDomain("localhost:8080", proxyDomains)).toBe(undefined)
|
||||
expect(http.getCookieDomain("127.0.0.1:8080", proxyDomains)).toBe(undefined)
|
||||
expect(http.getCookieDomain("8080.dev.localhost", proxyDomains)).toBe(undefined)
|
||||
})
|
||||
})
|
||||
|
||||
describe("constructRedirectPath", () => {
|
||||
it("should preserve slashes in queryString so they are human-readable", () => {
|
||||
const mockReq = getMockReq({
|
||||
|
||||
Reference in New Issue
Block a user