aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util/forgejo.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-05-19 21:46:01 +0900
committernsfisis <nsfisis@gmail.com>2026-05-19 21:46:08 +0900
commit5e31fa33c3b5cf726a57a063b8e7a070869250fe (patch)
tree98522466966fa7df483cad174ab5fc03db39bc09 /crates/shirabe/src/util/forgejo.rs
parentc839244d8d09f3036ebfee8eef7eb6b147e593ab (diff)
downloadphp-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.gz
php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.tar.zst
php-shirabe-5e31fa33c3b5cf726a57a063b8e7a070869250fe.zip
fix(compile): fix more random compile errors
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util/forgejo.rs')
-rw-r--r--crates/shirabe/src/util/forgejo.rs23
1 files changed, 14 insertions, 9 deletions
diff --git a/crates/shirabe/src/util/forgejo.rs b/crates/shirabe/src/util/forgejo.rs
index 3aaff91..88df409 100644
--- a/crates/shirabe/src/util/forgejo.rs
+++ b/crates/shirabe/src/util/forgejo.rs
@@ -9,12 +9,16 @@ use crate::util::http_downloader::HttpDownloader;
#[derive(Debug)]
pub struct Forgejo {
io: Box<dyn IOInterface>,
- config: Config,
- http_downloader: HttpDownloader,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
}
impl Forgejo {
- pub fn new(io: Box<dyn IOInterface>, config: Config, http_downloader: HttpDownloader) -> Self {
+ pub fn new(
+ io: Box<dyn IOInterface>,
+ config: std::rc::Rc<std::cell::RefCell<Config>>,
+ http_downloader: std::rc::Rc<std::cell::RefCell<HttpDownloader>>,
+ ) -> Self {
Self {
io,
config,
@@ -39,7 +43,7 @@ impl Forgejo {
io_interface::NORMAL,
);
self.io.write_error3(&url, true, io_interface::NORMAL);
- let local_auth_config = self.config.get_local_auth_config_source();
+ let local_auth_config = self.config.borrow().get_local_auth_config_source();
self.io.write_error3(
&format!(
"Tokens will be stored in plain text in \"{}\" for future use by Composer.",
@@ -47,7 +51,7 @@ impl Forgejo {
.as_ref()
.map(|s| format!("{} OR ", s.get_name()))
.unwrap_or_default()
- + self.config.get_auth_config_source().get_name()
+ + self.config.borrow().get_auth_config_source().get_name()
),
true,
io_interface::NORMAL,
@@ -92,7 +96,7 @@ impl Forgejo {
self.io
.set_authentication(origin_url.to_string(), username.clone(), token.clone());
- match self.http_downloader.get(
+ match self.http_downloader.borrow_mut().get(
&format!("https://{}/api/v1/version", origin_url),
indexmap::indexmap! {
"retry-auth-failure".to_string() => false.into(),
@@ -117,15 +121,16 @@ impl Forgejo {
}
// store value in local/user config
- let local_auth_config = self.config.get_local_auth_config_source();
+ let local_auth_config = self.config.borrow().get_local_auth_config_source();
let auth_config_source = if store_in_local_auth_config {
local_auth_config
.as_ref()
- .unwrap_or_else(|| self.config.get_auth_config_source())
+ .unwrap_or_else(|| self.config.borrow().get_auth_config_source())
} else {
- self.config.get_auth_config_source()
+ self.config.borrow().get_auth_config_source()
};
self.config
+ .borrow()
.get_config_source()
.remove_config_setting(&format!("forgejo-token.{}", origin_url));
auth_config_source.add_config_setting(