CreateClientApps
struct CreateClientApps : AsyncMigration
A Migration that seeds the client_app table from a JSON file in the seeds/ subdirectory of the project: client-apps.json
for release builds and test-client-apps.json otherwise, the same convention as the games catalog and registered-clients files.
The two files ship with identical contents; edit either to change what a new server starts with, or make a file [] to start empty.
The file is an array of objects:
{
"name": "Tricordarr",
"description": "A native Twitarr client for Android and iOS.",
"developer": "Grant Cohoe",
"sortName": "Tricordarr", // optional; defaults to name
"icon": "ClientApps/tricordarr.jpg", // optional; path relative to the seeds directory
"links": [ { "platform": "android", "url": "..." }, { "platform": "ios", "url": "..." } ],
"swiftarrClient": "tricordarr" // optional
}
A missing or unreadable icon file just results in a client app with no image. A missing or malformed seed file fails the migration.
-
Declaration
Swift
struct SeedApp : Decodable -
The seed file for this build: the real one for release builds, the test one otherwise.
Declaration
Swift
static var seedFileName: String { get } -
Declaration
Swift
static func loadSeedApps(from seedsDirectory: URL) throws -> [SeedApp] -
Resolves an
iconvalue, a path relative to the seeds directory, to a file URL. Returns nil if the path would escape the seeds directory (absolute paths,..), so a seed file can’t be used to read arbitrary files.Declaration
Swift
static func iconURL(for icon: String, seedsDirectory: URL) -> URL? -
prepare(on:Asynchronous) Declaration
Swift
func prepare(on database: Database) async throws -
revert(on:Asynchronous) Declaration
Swift
func revert(on database: Database) async throws
View on GitHub