Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ struct PlistQuery {
fetchurl: String,
}

static PLIST_TEMPLATE: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
async fn generate_plist(query: web::Query<PlistQuery>) -> impl Responder {
let plist_xml = format!(
r#"<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
Expand Down Expand Up @@ -39,14 +41,12 @@ static PLIST_TEMPLATE: &str = r#"<?xml version="1.0" encoding="UTF-8"?>
</dict>
</array>
</dict>
</plist>"#;

async fn generate_plist(query: web::Query<PlistQuery>) -> impl Responder {
let plist_xml = PLIST_TEMPLATE
.replace("{bundleid}", &query.bundleid)
.replace("{version}", &query.version)
.replace("{name}", &query.name)
.replace("{fetchurl}", &query.fetchurl);
</plist>"#,
bundleid = query.bundleid,
version = query.version,
name = query.name,
fetchurl = query.fetchurl
);

HttpResponse::Ok()
.content_type("application/octet-stream")
Expand All @@ -63,3 +63,4 @@ async fn main() -> std::io::Result<()> {
.run()
.await
}