support 'runts @latest/helloworld.ts'
This commit is contained in:
@@ -24,8 +24,19 @@ struct HttpsScriptMeta {
|
|||||||
download_time: u128,
|
download_time: u128,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn expand_at_script_file(script_file: &str) -> String {
|
||||||
|
if script_file.starts_with("@") && script_file.contains("/") {
|
||||||
|
let new_script_file = format!("https://script.hatter.ink/{}", script_file);
|
||||||
|
debugging!("Expend script file: {} -> {}", script_file, new_script_file);
|
||||||
|
return new_script_file;
|
||||||
|
}
|
||||||
|
script_file.to_string()
|
||||||
|
}
|
||||||
|
|
||||||
// download from internet if starts with https://
|
// download from internet if starts with https://
|
||||||
pub fn resolve_file(script_file: &str, force_update: bool) -> XResult<String> {
|
pub fn resolve_file(script_file: &str, force_update: bool) -> XResult<String> {
|
||||||
|
let script_file = expand_at_script_file(script_file);
|
||||||
|
let script_file = &script_file;
|
||||||
if script_file.starts_with("http://") {
|
if script_file.starts_with("http://") {
|
||||||
return simple_error!("Insecure script file: {}", script_file);
|
return simple_error!("Insecure script file: {}", script_file);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user