generated from Start9Labs/hello-world-startos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rework config to use nextcloud user (#27)
* rework config to use nextcloud user * migrate to new source format * fix migrations and paths
- Loading branch information
Showing
11 changed files
with
404 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { types as T } from "../deps.ts"; | ||
import { | ||
matchSubdomains, | ||
matchWebPageHomepageConfig, | ||
matchWebPageHomepageOld, | ||
matchWebPageSubdomain, | ||
matchWebPageSubdomainOld, | ||
} from "./types.ts"; | ||
|
||
export const revertHomepageConfigSource = (config: T.Config) => { | ||
if (matchWebPageHomepageConfig.test(config)) { | ||
const newHomepage: typeof matchWebPageHomepageOld._TYPE = { | ||
type: config.homepage.type, | ||
source: config.homepage.source.type, | ||
folder: config.homepage.source.folder, | ||
}; | ||
return { | ||
...config, | ||
homepage: newHomepage, | ||
}; | ||
} | ||
return config; | ||
}; | ||
|
||
export const revertSubdomainConfigSource = (config: T.Config) => { | ||
if (matchSubdomains.test(config)) { | ||
const newSubdomains = config.subdomains.map((sub) => { | ||
if (matchWebPageSubdomain.test(sub)) { | ||
const newSubdomain: typeof matchWebPageSubdomainOld._TYPE = { | ||
name: sub.name, | ||
settings: { | ||
type: "web-page", | ||
source: sub.settings.source.type, | ||
folder: sub.settings.source.folder, | ||
}, | ||
}; | ||
return newSubdomain; | ||
} | ||
return sub; | ||
}); | ||
return { | ||
...config, | ||
subdomains: newSubdomains, | ||
}; | ||
} | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { types as T } from "../deps.ts"; | ||
import { | ||
matchSubdomains, | ||
matchWebPageHomepage, | ||
matchWebPageHomepageConfigOld, | ||
matchWebPageSubdomain, | ||
matchWebPageSubdomainOld, | ||
} from "./types.ts"; | ||
|
||
export const convertHomepageConfigSource = (config: T.Config) => { | ||
if (matchWebPageHomepageConfigOld.test(config)) { | ||
switch (config.homepage.source) { | ||
case "nextcloud": { | ||
const newHomepage: typeof matchWebPageHomepage._TYPE = { | ||
type: config.homepage.type, | ||
source: { | ||
type: config.homepage.source, | ||
folder: config.homepage.folder, | ||
user: "embassy", | ||
}, | ||
}; | ||
return { | ||
...config, | ||
homepage: newHomepage, | ||
}; | ||
} | ||
case "filebrowser": { | ||
const newHomepage: typeof matchWebPageHomepage._TYPE = { | ||
type: config.homepage.type, | ||
source: { | ||
type: config.homepage.source, | ||
folder: config.homepage.folder!, | ||
}, | ||
}; | ||
return { | ||
...config, | ||
homepage: newHomepage, | ||
}; | ||
} | ||
default: { | ||
break; | ||
} | ||
} | ||
} | ||
return config; | ||
}; | ||
|
||
export const convertSubdomainConfigSource = (config: T.Config) => { | ||
if (matchSubdomains.test(config)) { | ||
const newSubdomains = config.subdomains.map((sub) => { | ||
if (matchWebPageSubdomainOld.test(sub)) { | ||
switch (sub.settings.source) { | ||
case "nextcloud": { | ||
const newSubdomain: typeof matchWebPageSubdomain._TYPE = { | ||
name: sub.name, | ||
settings: { | ||
type: "web-page", | ||
source: { | ||
type: sub.settings.source, | ||
folder: sub.settings.folder, | ||
// default username prior to nextcloud v26 when it was changed to admin | ||
user: "embassy", | ||
}, | ||
}, | ||
}; | ||
return newSubdomain; | ||
} | ||
case "filebrowser": { | ||
const newSubdomain: typeof matchWebPageSubdomain._TYPE = { | ||
name: sub.name, | ||
settings: { | ||
type: "web-page", | ||
source: { | ||
type: sub.settings.source, | ||
folder: sub.settings.folder, | ||
}, | ||
}, | ||
}; | ||
return newSubdomain; | ||
} | ||
default: { | ||
break; | ||
} | ||
} | ||
} | ||
return sub; | ||
}); | ||
return { | ||
...config, | ||
subdomains: newSubdomains, | ||
}; | ||
} | ||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.