mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-26 02:11:56 +00:00
feat: Origins can be null
This commit is contained in:
@@ -20,7 +20,7 @@ export const ipv6 = once(
|
||||
export const local = once(() => /\.local/)
|
||||
export class LocalBinding {
|
||||
constructor(readonly localHost: string, readonly ipHosts: string[]) {}
|
||||
createOrigins(protocol: string) {
|
||||
createOrigins(protocol: string | null) {
|
||||
const ipHosts = this.ipHosts
|
||||
return {
|
||||
local: new Origin(protocol, this.localHost),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export class Origin {
|
||||
constructor(readonly protocol: string, readonly host: string) {}
|
||||
constructor(readonly protocol: string | null, readonly host: string) {}
|
||||
|
||||
withAuth(
|
||||
origin?:
|
||||
@@ -13,6 +13,7 @@ export class Origin {
|
||||
// prettier-ignore
|
||||
const urlAuth = !!(origin) ? `${origin.username}${origin.password != null ?`:${origin.password}`:''}@` :
|
||||
'';
|
||||
return `${this.protocol}://${urlAuth}${this.host}`
|
||||
const protocolSection = this.protocol != null ? `${this.protocol}://` : ""
|
||||
return `${protocolSection}${urlAuth}${this.host}`
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Origin } from "./Origin"
|
||||
|
||||
export class TorBinding {
|
||||
constructor(readonly host: string) {}
|
||||
createOrigin(protocol: string) {
|
||||
createOrigin(protocol: string | null) {
|
||||
return new Origin(protocol, this.host)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user