misc fixes

This commit is contained in:
Aiden McClelland
2021-09-01 16:14:31 -06:00
committed by Aiden McClelland
parent 4de560c342
commit 824bccda0e
5 changed files with 12 additions and 8 deletions

View File

@@ -117,7 +117,7 @@ pub async fn login(
res.headers.insert( res.headers.insert(
"set-cookie", "set-cookie",
HeaderValue::from_str(&format!( HeaderValue::from_str(&format!(
"session={}; SameSite=Strict; Expires=Fri, 31 Dec 9999 23:59:59 GMT;", "session={}; SameSite=Lax; Expires=Fri, 31 Dec 9999 23:59:59 GMT;",
token token
)) ))
.with_kind(crate::ErrorKind::Unknown)?, // Should be impossible, but don't want to panic .with_kind(crate::ErrorKind::Unknown)?, // Should be impossible, but don't want to panic

View File

@@ -171,6 +171,6 @@ pub async fn ui(
let ptr = "/ui".parse::<JsonPointer>()? + &pointer; let ptr = "/ui".parse::<JsonPointer>()? + &pointer;
Ok(WithRevision { Ok(WithRevision {
response: (), response: (),
revision: ctx.db.put(&ptr, &value, None).await?, revision: Some(ctx.db.put(&ptr, &value, None).await?),
}) })
} }

View File

@@ -147,9 +147,9 @@ impl StaticFiles {
} }
pub fn remote(id: &PackageId, version: &Version, icon_type: &str) -> Self { pub fn remote(id: &PackageId, version: &Version, icon_type: &str) -> Self {
StaticFiles { StaticFiles {
license: format!("/registry/packages/{}/{}/LICENSE.md", id, version), license: format!("/marketplace/package/{}/{}/LICENSE.md", id, version),
instructions: format!("/registry/packages/{}/{}/INSTRUCTIONS.md", id, version), instructions: format!("/marketplace/package/{}/{}/INSTRUCTIONS.md", id, version),
icon: format!("/registry/packages/{}/{}/icon.{}", id, version, icon_type), icon: format!("/marketplace/package/{}/{}/icon.{}", id, version, icon_type),
} }
} }
} }

View File

@@ -6,5 +6,5 @@ use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Serialize)] #[derive(Clone, Debug, Deserialize, Serialize)]
pub struct WithRevision<T> { pub struct WithRevision<T> {
pub response: T, pub response: T,
pub revision: Arc<Revision>, pub revision: Option<Arc<Revision>>,
} }

View File

@@ -304,6 +304,7 @@ pub async fn download_install_s9pk(
let mut tx = handle.begin().await?; let mut tx = handle.begin().await?;
if let Err(e) = cleanup_failed(&ctx, &mut tx, pkg_id, version).await { if let Err(e) = cleanup_failed(&ctx, &mut tx, pkg_id, version).await {
let mut tx = handle.begin().await?;
log::error!( log::error!(
"Failed to clean up {}@{}: {}: Adding to broken packages", "Failed to clean up {}@{}: {}: Adding to broken packages",
pkg_id, pkg_id,
@@ -312,10 +313,13 @@ pub async fn download_install_s9pk(
); );
let mut broken = crate::db::DatabaseModel::new() let mut broken = crate::db::DatabaseModel::new()
.broken_packages() .broken_packages()
.get_mut(&mut handle) .get_mut(&mut tx)
.await?; .await?;
broken.push(pkg_id.clone()); broken.push(pkg_id.clone());
broken.save(&mut handle).await?; broken.save(&mut tx).await?;
tx.commit(None).await?;
} else {
tx.commit(None).await?;
} }
Err(e) Err(e)
} else { } else {