mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-06 02:00:46 +00:00
headers to make iOS Safari work (maybe?)
This commit is contained in:
1 parent
985e5e3549
commit
078f2183b1
2 files changed
+37
-6
No files matched your search
@@ -1,9 +1,6 @@
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::http::{StatusCode, header};
|
||||
use actix_web::web::{Data, Query};
|
||||
use actix_web::{
|
||||
HttpRequest,
|
||||
HttpResponse,
|
||||
};
|
||||
use actix_web::{HttpRequest, HttpResponse};
|
||||
|
||||
use std::sync::Arc;
|
||||
use crate::AppState;
|
||||
@@ -146,8 +143,21 @@ pub async fn legacy_get_speak(request: HttpRequest,
|
||||
segfaults are fixed."))
|
||||
},
|
||||
Some(wav_data) => {
|
||||
// To make iOS Safari work, you need a Content-Range and Content-Length header:
|
||||
// https://stackoverflow.com/a/17835399
|
||||
// Content-Range: bytes XX-XX/XX
|
||||
// Content-Type: audio/wav
|
||||
// Content-Disposition: attachment; filename = "new.WAV"
|
||||
// Content-Length: XX
|
||||
//
|
||||
// Content-Range: bytes */*
|
||||
// Content-Type: audio/wav
|
||||
// Content-Disposition:
|
||||
// Content-Length: len()
|
||||
Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("audio/wav")
|
||||
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
|
||||
.set_header(header::CONTENT_RANGE, "bytes */*")
|
||||
.body(wav_data))
|
||||
},
|
||||
}
|
||||
@@ -188,8 +198,21 @@ pub async fn legacy_get_speak(request: HttpRequest,
|
||||
|
||||
let wav_data = arpabet_glow_tts_melgan_pipeline(&cleaned_text, &glow_tts, &melgan);
|
||||
|
||||
// To make iOS Safari work, you need a Content-Range and Content-Length header:
|
||||
// https://stackoverflow.com/a/17835399
|
||||
// Content-Range: bytes XX-XX/XX
|
||||
// Content-Type: audio/wav
|
||||
// Content-Disposition: attachment; filename = "new.WAV"
|
||||
// Content-Length: XX
|
||||
//
|
||||
// Content-Range: bytes */*
|
||||
// Content-Type: audio/wav
|
||||
// Content-Disposition:
|
||||
// Content-Length: len()
|
||||
Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("audio/wav")
|
||||
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
|
||||
.set_header(header::CONTENT_RANGE, "bytes */*")
|
||||
.body(wav_data))
|
||||
},
|
||||
ModelPipeline::RawTextTacotronMelgan => unimplemented!(),
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use actix_web::http::StatusCode;
|
||||
use actix_web::http::{StatusCode, header};
|
||||
use actix_web::web::{
|
||||
Data,
|
||||
Json,
|
||||
@@ -105,8 +105,12 @@ pub async fn post_speak(request: HttpRequest,
|
||||
segfaults are fixed."))
|
||||
},
|
||||
Some(wav_data) => {
|
||||
// To make iOS Safari work, you need a Content-Range and Content-Length header:
|
||||
// https://stackoverflow.com/a/17835399
|
||||
Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("audio/wav")
|
||||
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
|
||||
.set_header(header::CONTENT_RANGE, "bytes */*")
|
||||
.body(wav_data))
|
||||
},
|
||||
}
|
||||
@@ -134,8 +138,12 @@ pub async fn post_speak(request: HttpRequest,
|
||||
|
||||
let wav_data = arpabet_glow_tts_melgan_pipeline(&cleaned_text, &glow_tts, &melgan);
|
||||
|
||||
// To make iOS Safari work, you need a Content-Range and Content-Length header:
|
||||
// https://stackoverflow.com/a/17835399
|
||||
Ok(HttpResponse::build(StatusCode::OK)
|
||||
.content_type("audio/wav")
|
||||
.set_header(header::CONTENT_DISPOSITION, "attachment; filename = \"generated.wav\"")
|
||||
.set_header(header::CONTENT_RANGE, "bytes */*")
|
||||
.body(wav_data))
|
||||
},
|
||||
ModelPipeline::RawTextTacotronMelgan => unimplemented!(),
|
||||
|
||||
Reference in new issue
Block a user