1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Re-add a good way to disable factory uploading

This commit is contained in:
NG (Graham)
2026-01-01 21:25:24 -05:00
parent 3aadbb91ba
commit 495701d886
2 changed files with 10 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ pub struct ArcAdapter {
cdn: String,
override_cdn: bool,
spoof_users: bool,
is_readonly: bool,
}
impl ArcAdapter {
@@ -21,6 +22,7 @@ impl ArcAdapter {
cdn: cdn.to_owned(),
override_cdn,
spoof_users: username_spoofing,
is_readonly: uri.ends_with("?mode=ro")
};
// do query to ensure database is ok
adapter.default_query().one(&adapter.orm).await?;
@@ -184,6 +186,13 @@ impl crate::VehicleFactoryAdapter for ArcAdapter {
}
async fn upload(&self, vehicle: crate::VehicleUploadInfo) -> Result<crate::VehicleThumbnailInfo, Box<dyn std::error::Error>> {
if self.is_readonly {
return Ok(crate::VehicleThumbnailInfo {
id: 0,
thumbnail: Vec::default(),
needs_upload: false,
})
}
let transaction = self.orm.begin().await?;
let cube_amounts = {