refactor(web): use the canonical channel entry
Remove the duplicate channel-preview route and move its launcher, owner-link, acceptance and documentation callers to the existing root URL. Query and invitation fragments retain their meaning. App launcher and component preview routes stay separate. Route, session and built-server protocol checks pass.
This commit is contained in:
1 parent
3476723ca0
commit
7a7ff696ca
11 files changed
+28
-35
No files matched your search
@@ -152,7 +152,7 @@ async fn main() -> anyhow::Result<std::process::ExitCode> {
|
||||
)?;
|
||||
let operator = owner_link::Listener::bind(&directory)?;
|
||||
println!("Piik Server: http://{bound}");
|
||||
println!("Web interface: {origin}/__channel-preview");
|
||||
println!("Web interface: {origin}/");
|
||||
release::startup_notice();
|
||||
let operator_domain = state.clone();
|
||||
let (stop_server, operator_stopped) = tokio::sync::oneshot::channel();
|
||||
|
||||
@@ -27,7 +27,7 @@ pub async fn request(directory: &Path) -> Result<String> {
|
||||
pub use transport::Listener;
|
||||
|
||||
pub async fn serve(mut listener: Listener, domain: &Domain) -> Result<()> {
|
||||
let target = url::Url::parse(domain.origin())?.join("/__channel-preview")?;
|
||||
let target = url::Url::parse(domain.origin())?.join("/")?;
|
||||
loop {
|
||||
let mut stream = listener.accept().await?;
|
||||
let Ok(ticket) = domain.launch_ticket() else {
|
||||
|
||||
@@ -126,7 +126,6 @@ pub fn frontend(directory: &Path) -> anyhow::Result<Router> {
|
||||
Ok(Router::new()
|
||||
.merge(bundle_routes(directory)?)
|
||||
.route("/", document(index.clone()))
|
||||
.route("/__channel-preview", document(index.clone()))
|
||||
.route("/index.html", document(index.clone()))
|
||||
.fallback_service(static_files(
|
||||
ServeDir::new(directory).append_index_html_on_directories(false),
|
||||
@@ -520,12 +519,7 @@ mod tests {
|
||||
fs::remove_file(directory.join("assets/new.js")).unwrap();
|
||||
fs::write(directory.join("assets/old.js"), "old").unwrap();
|
||||
let mut responses = Vec::new();
|
||||
for path in [
|
||||
"/",
|
||||
"/__channel-preview",
|
||||
"/index.html",
|
||||
"/spa/client/route",
|
||||
] {
|
||||
for path in ["/", "/index.html", "/spa/client/route"] {
|
||||
for modified in [&cached_modified[..], "Thu, 01 Jan 2099 00:00:00 GMT"] {
|
||||
responses.push(request(address, path, Some(modified)).await);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user