a cloud compiler service
This commit is contained in:
parent
832555cbad
commit
6a9aee02b7
@ -21,8 +21,6 @@ impl Builder {
|
||||
async fn build(&self, args: &RequestBuildArgs) -> Result<(), Box<dyn Error>> {
|
||||
Command::new("python3")
|
||||
.current_dir("./ssm/dynamic/")
|
||||
.env("VENDOR_NAME", &args.vendor_name)
|
||||
.env("VENDOR_METAMASK_ACCOUNT", &args.vendor_metamask_account)
|
||||
.env("RAW_AEAD_KEY", &args.aead_key)
|
||||
.env("RAW_SSL_PRIVATE_KEY", &args.ssl_private_key)
|
||||
.args(["gen.py"])
|
||||
@ -39,15 +37,9 @@ impl Builder {
|
||||
"-o",
|
||||
&format!("ssm-{}", args.token),
|
||||
"-gccgoflags",
|
||||
"-static-libgo -Wl,--version-script=ssm.version",
|
||||
"-static -Wl,--version-script=ssm.version",
|
||||
"-mllvm",
|
||||
"-obfuscation=gvo",
|
||||
"-mllvm",
|
||||
"-obfuscation=sub",
|
||||
"-mllvm",
|
||||
"-obfuscation=flatten",
|
||||
"-mllvm",
|
||||
"-obfuscation=idr-branch",
|
||||
"-obfuscation=gvo -obfuscation=sub -obfuscation=flatten -obfuscation=idr-branch",
|
||||
])
|
||||
.spawn()?
|
||||
.wait()
|
||||
@ -78,7 +70,7 @@ pub async fn setup_builder(
|
||||
builder: Builder,
|
||||
) {
|
||||
while let Some(args) = receiver.recv().await {
|
||||
println!("requesting build {:?}", args);
|
||||
// trace!("requesting build {:?}", args);
|
||||
sender
|
||||
.send(Request::SetToken(args.token.clone(), TokenStatus::Building))
|
||||
.await
|
||||
|
@ -65,14 +65,7 @@ async fn main() {
|
||||
sender: sender.clone(),
|
||||
token_list: token_list.clone(),
|
||||
})
|
||||
.mount(
|
||||
"/",
|
||||
routes![
|
||||
routes::route_build,
|
||||
routes::route_status,
|
||||
routes::route_download
|
||||
],
|
||||
)
|
||||
.mount("/", routes::main())
|
||||
.launch()
|
||||
.await
|
||||
.ok();
|
||||
|
@ -14,7 +14,6 @@ async fn process_request(
|
||||
token_list.insert(token.clone(), TokenStatus::Initialized);
|
||||
}
|
||||
Request::SetToken(token, new_status) => {
|
||||
println!("set token {:?} {:?}", token, new_status);
|
||||
let mut token_list = token_list.lock().unwrap();
|
||||
if let Some(state) = token_list.get_mut(&token) {
|
||||
*state = new_status;
|
||||
|
@ -11,8 +11,6 @@ use crate::types::{AppState, Request, RequestBuildArgs};
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(crate = "rocket::serde")]
|
||||
pub struct BuildArgs {
|
||||
vendor_name: String,
|
||||
vendor_metamask_account: String,
|
||||
aead_key: String,
|
||||
ssl_private_key: String,
|
||||
}
|
||||
@ -26,7 +24,6 @@ pub struct BuildResponse {
|
||||
#[post("/build", data = "<args>")]
|
||||
pub async fn route(state: &State<AppState>, args: Json<BuildArgs>) -> Json<BuildResponse> {
|
||||
let args = &*args;
|
||||
println!("build with args={:?}", args);
|
||||
|
||||
let sender = &state.sender;
|
||||
let token = Uuid::new_v4().to_string();
|
||||
@ -35,8 +32,6 @@ pub async fn route(state: &State<AppState>, args: Json<BuildArgs>) -> Json<Build
|
||||
sender
|
||||
.send(Request::Build(RequestBuildArgs {
|
||||
token: token.clone(),
|
||||
vendor_name: args.vendor_name.clone(),
|
||||
vendor_metamask_account: args.vendor_metamask_account.clone(),
|
||||
aead_key: args.aead_key.clone(),
|
||||
ssl_private_key: args.ssl_private_key.clone(),
|
||||
}))
|
||||
|
@ -2,6 +2,6 @@ mod build;
|
||||
mod download;
|
||||
mod status;
|
||||
|
||||
pub use build::route as route_build;
|
||||
pub use download::route as route_download;
|
||||
pub use status::route as route_status;
|
||||
pub fn main() -> Vec<rocket::Route> {
|
||||
rocket::routes![build::route, status::route, download::route,]
|
||||
}
|
||||
|
@ -16,8 +16,6 @@ pub enum Request {
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct RequestBuildArgs {
|
||||
pub token: String,
|
||||
pub vendor_name: String,
|
||||
pub vendor_metamask_account: String,
|
||||
pub aead_key: String,
|
||||
pub ssl_private_key: String,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user