// An app-release dashboard reading an iOS app's Info.plist, and a binary plist made and read back.
//
//   quillo run plist.qwe      then open http://localhost:8080/app

use "plist.qwer"

route GET /app {
    let info = plist_read_file("plist_sample.plist")?
    { name: info.CFBundleDisplayName, bundle: info.CFBundleIdentifier, version: `${info.CFBundleShortVersionString} (${info.CFBundleVersion})`, built: info.BuildDate, icon_hash: info.IconHash, orientations: len(info.UISupportedInterfaceOrientations) }
}

route GET /binary {
    let packed = plist_to_binary({ server: "https://shop.example.com", retries: 3, timeout: 2.5, beta: true, unset: null })?
    { packed, binary: starts_with(packed, "YnBsaXN0"), back: plist_decode(packed)? }
}

route GET /profile.plist = respond(200, plist_to_xml({ PayloadDisplayName: "Quillo Shop Wi-Fi", PayloadType: "Configuration", PayloadVersion: 1, PayloadContent: [{ SSID_STR: "QuilloGuest", EncryptionType: "WPA2" }] })?, { "content-type": "application/xml" })
