Compare commits
2 commits
b403751228
...
0f14834e2d
Author | SHA1 | Date | |
---|---|---|---|
0f14834e2d | |||
94b64b4619 |
5 changed files with 51 additions and 23 deletions
43
Cargo.lock
generated
43
Cargo.lock
generated
|
@ -640,9 +640,9 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
|
|||
|
||||
[[package]]
|
||||
name = "crc32fast"
|
||||
version = "1.4.0"
|
||||
version = "1.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa"
|
||||
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
@ -658,9 +658,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.19"
|
||||
version = "0.8.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345"
|
||||
checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"
|
||||
|
||||
[[package]]
|
||||
name = "crypto-common"
|
||||
|
@ -910,7 +910,6 @@ dependencies = [
|
|||
"sdk",
|
||||
"serde",
|
||||
"serde_sjson",
|
||||
"string_template",
|
||||
"strip-ansi-escapes",
|
||||
"time",
|
||||
"tokio",
|
||||
|
@ -2011,6 +2010,12 @@ version = "0.4.13"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
||||
|
||||
[[package]]
|
||||
name = "lockfree-object-pool"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e"
|
||||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.21"
|
||||
|
@ -3435,18 +3440,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.60"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18"
|
||||
checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.60"
|
||||
version = "1.0.61"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524"
|
||||
checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
@ -4426,9 +4431,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
|
|||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "1.3.0"
|
||||
version = "2.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f1f4a27345eb6f7aa7bd015ba7eb4175fa4e1b462a29874b779e0bbcf96c6ac7"
|
||||
checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"bzip2",
|
||||
|
@ -4437,11 +4442,27 @@ dependencies = [
|
|||
"displaydoc",
|
||||
"flate2",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"thiserror",
|
||||
"time",
|
||||
"zopfli",
|
||||
"zstd",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zopfli"
|
||||
version = "0.8.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e5019f391bac5cf252e93bbcc53d039ffd62c7bfb7c150414d61369afe57e946"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"crc32fast",
|
||||
"lockfree-object-pool",
|
||||
"log",
|
||||
"once_cell",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zstd"
|
||||
version = "0.13.1"
|
||||
|
|
|
@ -13,7 +13,7 @@ members = [
|
|||
exclude = ["lib/color-eyre"]
|
||||
|
||||
[workspace.dependencies]
|
||||
zip = { version = "1.3.0", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] }
|
||||
zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] }
|
||||
|
||||
[patch.crates-io]
|
||||
color-eyre = { path = "lib/color-eyre" }
|
||||
|
|
|
@ -29,7 +29,6 @@ path-slash = "0.2.1"
|
|||
sdk = { path = "../../lib/sdk", version = "*" }
|
||||
serde = { version = "1.0.152", features = ["derive", "rc"] }
|
||||
serde_sjson = { path = "../../lib/serde_sjson", version = "*" }
|
||||
string_template = "0.2.1"
|
||||
strip-ansi-escapes = "0.2.0"
|
||||
time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset"] }
|
||||
tokio = { version = "1.23.0", features = ["rt", "fs", "tracing", "sync"] }
|
||||
|
|
|
@ -17,7 +17,7 @@ local require_store = {}
|
|||
|
||||
-- This token is treated as a string template and filled by DTMM during deployment.
|
||||
-- This allows hiding unsafe I/O functions behind a setting.
|
||||
-- It's also a valid table definition, thereby degrading gracefully when not replaced.
|
||||
-- When not replaced, it's also a valid table definition, thereby degrading gracefully.
|
||||
local is_io_enabled = {{ is_io_enabled }} -- luacheck: ignore 113
|
||||
local lua_libs = {
|
||||
debug = debug,
|
||||
|
@ -207,3 +207,5 @@ function init()
|
|||
|
||||
Main:init()
|
||||
end
|
||||
|
||||
-- vim: ft=lua
|
|
@ -1,4 +1,3 @@
|
|||
use std::collections::HashMap;
|
||||
use std::io::{Cursor, ErrorKind};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
|
@ -16,7 +15,6 @@ use sdk::{
|
|||
Bundle, BundleDatabase, BundleFile, BundleFileType, BundleFileVariant, FromBinary, ToBinary,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use string_template::Template;
|
||||
use time::OffsetDateTime;
|
||||
use tokio::fs::{self, DirEntry};
|
||||
use tokio::io::AsyncWriteExt;
|
||||
|
@ -572,12 +570,17 @@ async fn patch_boot_bundle(state: Arc<ActionState>) -> Result<Vec<Bundle>> {
|
|||
let span = tracing::debug_span!("Importing mod main script");
|
||||
let _enter = span.enter();
|
||||
|
||||
let is_io_enabled = format!("{}", state.is_io_enabled);
|
||||
let mut data = HashMap::new();
|
||||
data.insert("is_io_enabled", is_io_enabled.as_str());
|
||||
let mut env = Environment::new();
|
||||
env.add_template("mod_main.lua", include_str!("../../assets/mod_main.lua.j2"))
|
||||
.wrap_err("Failed to compile template for `mod_main.lua`")?;
|
||||
let tmpl = env
|
||||
.get_template("mod_main.lua")
|
||||
.wrap_err("Failed to get template `mod_main.lua`")?;
|
||||
|
||||
let lua = tmpl
|
||||
.render(minijinja::context!(is_io_enabled => if state.is_io_enabled { "true" } else {"false"}))
|
||||
.wrap_err("Failed to render template `mod_main.lua`")?;
|
||||
|
||||
let tmpl = include_str!("../../assets/mod_main.lua");
|
||||
let lua = Template::new(tmpl).render(&data);
|
||||
tracing::trace!("Main script rendered:\n===========\n{}\n=============", lua);
|
||||
let file =
|
||||
lua::compile(MOD_BOOT_SCRIPT, lua).wrap_err("Failed to compile mod main Lua file")?;
|
||||
|
@ -707,7 +710,7 @@ pub(crate) async fn deploy_mods(state: ActionState) -> Result<()> {
|
|||
},
|
||||
async {
|
||||
let path = state.game_dir.join(DEPLOYMENT_DATA_PATH);
|
||||
match read_sjson_file::<_, DeploymentData>(path).await {
|
||||
match read_sjson_file::<_, DeploymentData>(&path).await {
|
||||
Ok(data) => Ok(Some(data)),
|
||||
Err(err) => {
|
||||
if let Some(err) = err.downcast_ref::<std::io::Error>()
|
||||
|
@ -715,7 +718,10 @@ pub(crate) async fn deploy_mods(state: ActionState) -> Result<()> {
|
|||
{
|
||||
Ok(None)
|
||||
} else {
|
||||
Err(err).wrap_err("Failed to read deployment data")
|
||||
Err(err).wrap_err(format!(
|
||||
"Failed to read deployment data from: {}",
|
||||
path.display()
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue