mirror of
https://codeberg.org/icewind/haze.git
synced 2026-08-02 12:14:46 +02:00
add sftp with key authentication service
This commit is contained in:
parent
f99238121b
commit
204fb676d6
19 changed files with 348 additions and 135 deletions
|
|
@ -30,7 +30,7 @@ pub use crate::service::office::Office;
|
|||
pub use crate::service::onlyoffice::OnlyOffice;
|
||||
pub use crate::service::push::NotifyPush;
|
||||
use crate::service::redis::Redis;
|
||||
use crate::service::sftp::Sftp;
|
||||
use crate::service::sftp::{Sftp, SftpKey};
|
||||
use crate::service::sharded::{Sharding, ShardingMigrate, ShardingMigrateUnset, SingleShard};
|
||||
use crate::service::smb::Smb;
|
||||
use crate::service::webhook::Webhook;
|
||||
|
|
@ -116,7 +116,7 @@ pub trait ServiceTrait {
|
|||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
_config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
Ok(Vec::new())
|
||||
}
|
||||
|
||||
|
|
@ -267,6 +267,8 @@ pub enum ServiceType {
|
|||
Dav,
|
||||
/// Sftp external storage
|
||||
Sftp,
|
||||
/// Sftp external storage with public key authentication
|
||||
SftpKey,
|
||||
/// ownCloud instance for migration
|
||||
Oc,
|
||||
/// Imaginary for preview generation
|
||||
|
|
@ -318,6 +320,7 @@ pub enum Service {
|
|||
ShardingMigrate(ShardingMigrate),
|
||||
ShardingMigrateUnset(ShardingMigrateUnset),
|
||||
Sftp(Sftp),
|
||||
SftpKey(SftpKey),
|
||||
Kaspersky(Kaspersky),
|
||||
KasperskyIcap(KasperskyIcap),
|
||||
Clam(Clam),
|
||||
|
|
@ -361,6 +364,7 @@ impl Service {
|
|||
}
|
||||
ServiceType::Dav => Some(vec![Service::Dav(Dav)]),
|
||||
ServiceType::Sftp => Some(vec![Service::Sftp(Sftp)]),
|
||||
ServiceType::SftpKey => Some(vec![Service::SftpKey(SftpKey)]),
|
||||
ServiceType::Oc => Some(vec![Service::Oc(Oc)]),
|
||||
ServiceType::Imaginary => Some(vec![Service::Imaginary(Imaginary)]),
|
||||
ServiceType::Kaspersky => Some(vec![Service::Kaspersky(Kaspersky)]),
|
||||
|
|
@ -437,15 +441,29 @@ impl ServiceTrait for PresetService {
|
|||
_docker: &Docker,
|
||||
_cloud_id: &str,
|
||||
config: &HazeConfig,
|
||||
) -> Result<Vec<String>> {
|
||||
) -> Result<Vec<Vec<String>>> {
|
||||
let preset =
|
||||
get_preset(&config.preset, &self.0).ok_or_else(|| Report::msg("invalid preset"))?;
|
||||
let mut commands: Vec<_> = preset
|
||||
.apps
|
||||
.iter()
|
||||
.map(|app| format!("occ app:enable {app} --force"))
|
||||
.map(|app| {
|
||||
vec![
|
||||
"occ".into(),
|
||||
"app:enable".into(),
|
||||
app.clone(),
|
||||
"--force".into(),
|
||||
]
|
||||
})
|
||||
.collect();
|
||||
commands.extend_from_slice(&preset.commands);
|
||||
for cmnd in &preset.commands {
|
||||
commands.push(shell_words::split(cmnd).into_diagnostic()?);
|
||||
}
|
||||
|
||||
Ok(commands)
|
||||
}
|
||||
}
|
||||
|
||||
fn split_cmnd(s: &str) -> Vec<String> {
|
||||
s.split(' ').map(String::from).collect()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue