1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use crate::commands::dev::ServerConfig;
use crate::preview::upload;
use crate::settings::global_user::GlobalUser;
use crate::settings::toml::Target;
use uuid::Uuid;
pub(super) fn get_session_id() -> Result<String, failure::Error> {
Ok(Uuid::new_v4().to_simple().to_string())
}
pub fn get_preview_id(
mut target: Target,
user: Option<GlobalUser>,
server_config: &ServerConfig,
session_id: &str,
verbose: bool,
) -> Result<String, failure::Error> {
let sites_preview = false;
let script_id = upload(&mut target, user.as_ref(), sites_preview, verbose)?;
Ok(format!(
"{}{}{}{}",
&script_id,
session_id,
server_config.host.is_https() as u8,
server_config.host
))
}