diff --git a/.github/workflows/web-test.yml b/.github/workflows/web-test.yml index 61c7ef060..80676620e 100644 --- a/.github/workflows/web-test.yml +++ b/.github/workflows/web-test.yml @@ -1,5 +1,6 @@ name: Test Web UI on: + pull_request_target: push: branches: - main @@ -18,6 +19,8 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.base.ref }} - uses: actions/setup-node@v4 with: diff --git a/common/src/config.rs b/common/src/config.rs index e2afd0335..109d4c3e1 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -9,6 +9,8 @@ use std::collections::HashMap; use std::path::PathBuf; use std::rc::Rc; +use crate::utils; + #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Config { pub base_dir: PathBuf, @@ -92,8 +94,12 @@ impl Default for Config { ); std::fs::create_dir_all(&base_dir).unwrap(); - // use mega/config.toml because mega use sqlite as default db - let default_config = include_str!("../../mega/config.toml"); + let bin_name = utils::get_current_bin_name(); + let default_config = match bin_name.as_str() { + "mono" => include_str!("../../config/config.toml"), + "mega" => include_str!("../../mega/config.toml"), + _ => include_str!("../../mega/config.toml"), + }; let default_config = default_config .lines() .map(|line| { diff --git a/common/src/utils.rs b/common/src/utils.rs index 5efaf7a1d..36d5a6c25 100644 --- a/common/src/utils.rs +++ b/common/src/utils.rs @@ -126,6 +126,15 @@ pub fn check_conventional_commits_message(msg: &str) -> bool { false } +pub fn get_current_bin_name() -> String { + let bin_path = std::env::args().next().unwrap_or_default(); + std::path::Path::new(&bin_path) + .file_name() + .and_then(|os_str| os_str.to_str()) + .unwrap_or("unknown") + .to_owned() +} + #[cfg(test)] mod test { use super::*; diff --git a/docker/start-mono.sh b/docker/start-mono.sh index 864d5561b..4e37b2a55 100755 --- a/docker/start-mono.sh +++ b/docker/start-mono.sh @@ -6,7 +6,7 @@ CONFIG_FILE="$MEGA_BASE_DIR/etc/config.toml" # check if config file exists if [ -f "$CONFIG_FILE" ]; then echo "Using config file: $CONFIG_FILE" - exec /usr/local/bin/mono -c "$CONFIG_FILE" service multi http ssh --host 0.0.0.0 --http-port 8000 --ssh-port 9000 + exec /usr/local/bin/mono -c "$CONFIG_FILE" service multi http ssh --host 0.0.0.0 --port 8000 --ssh-port 9000 else exec /usr/local/bin/mono service multi http ssh --host 0.0.0.0 --ssh-port 22 fi \ No newline at end of file diff --git a/libra/src/internal/protocol/lfs_client.rs b/libra/src/internal/protocol/lfs_client.rs index 23879e11d..b80f92b73 100644 --- a/libra/src/internal/protocol/lfs_client.rs +++ b/libra/src/internal/protocol/lfs_client.rs @@ -821,6 +821,8 @@ mod tests { } #[tokio::test] + #[ignore] + // Do not use mega repo in unit test, because mega exceeded its LFS budget. The account responsible for the budget should increase it to restore access async fn test_github_batch() { let batch_request = BatchRequest { operation: Operation::Download,