mirror of
https://github.com/coder/code-server.git
synced 2025-07-29 13:02:10 +08:00
Generalize initial app logic
This commit is contained in:
@ -116,7 +116,6 @@ interface ProviderRoute extends Route {
|
||||
}
|
||||
|
||||
export interface HttpProviderOptions {
|
||||
readonly base: string
|
||||
readonly auth: AuthType
|
||||
readonly password?: string
|
||||
readonly commit: string
|
||||
@ -154,7 +153,7 @@ export abstract class HttpProvider {
|
||||
* Get the base relative to the provided route.
|
||||
*/
|
||||
public base(route: Route): string {
|
||||
const depth = route.fullPath ? (route.fullPath.match(/\//g) || []).length : 1
|
||||
const depth = ((route.fullPath + "/").match(/\//g) || []).length
|
||||
return normalize("./" + (depth > 1 ? "../".repeat(depth - 1) : ""))
|
||||
}
|
||||
|
||||
@ -404,7 +403,6 @@ export class HttpServer {
|
||||
new provider(
|
||||
{
|
||||
auth: this.options.auth || AuthType.None,
|
||||
base: endpoint,
|
||||
commit: this.options.commit,
|
||||
password: this.options.password,
|
||||
},
|
||||
|
Reference in New Issue
Block a user