mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
Continue hacking away reimplementing server
This commit is contained in:
parent
2b808b12fe
commit
2a4704f5b0
2 changed files with 21 additions and 23 deletions
|
|
@ -1,36 +1,34 @@
|
|||
use std::path::Path;
|
||||
use std::process;
|
||||
use std::fs;
|
||||
use std::{
|
||||
path::Path,
|
||||
process,
|
||||
sync::Arc,
|
||||
};
|
||||
|
||||
use rand;
|
||||
|
||||
use project::Project;
|
||||
// use web::{self, WebConfig};
|
||||
// use session::Session;
|
||||
use roblox_studio;
|
||||
use ::{
|
||||
project::Project,
|
||||
web::Server,
|
||||
serve_session::ServeSession,
|
||||
roblox_studio,
|
||||
};
|
||||
|
||||
pub fn serve(fuzzy_project_location: &Path) {
|
||||
let server_id = rand::random::<u64>();
|
||||
|
||||
let project = match Project::load_fuzzy(fuzzy_project_location) {
|
||||
Ok(project) => {
|
||||
println!("Using project from {}", fs::canonicalize(&project.file_location).unwrap().display());
|
||||
project
|
||||
},
|
||||
Ok(project) => project,
|
||||
Err(error) => {
|
||||
eprintln!("{}", error);
|
||||
eprintln!("Fatal: {}", error);
|
||||
process::exit(1);
|
||||
},
|
||||
};
|
||||
|
||||
println!("Found project at {}", project.file_location.display());
|
||||
println!("Using project {:#?}", project);
|
||||
|
||||
roblox_studio::install_bundled_plugin().unwrap();
|
||||
|
||||
// let mut session = Session::new(project.clone());
|
||||
// session.start();
|
||||
let session = Arc::new(ServeSession::new(project));
|
||||
let server = Server::new(Arc::from(session));
|
||||
|
||||
// let web_config = WebConfig::from_session(server_id, port, &session);
|
||||
println!("Server listening on port 8000.");
|
||||
|
||||
// web::start(web_config);
|
||||
server.listen(8000);
|
||||
}
|
||||
|
|
@ -1,13 +1,13 @@
|
|||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::sync::{mpsc, RwLock, Arc};
|
||||
use std::sync::{mpsc, Arc};
|
||||
|
||||
use rouille::{self, Request, Response};
|
||||
use rand;
|
||||
|
||||
use ::{
|
||||
id::Id,
|
||||
message_session::{MessageSession, Message},
|
||||
message_session::Message,
|
||||
project::Project,
|
||||
rbx::RbxInstance,
|
||||
serve_session::ServeSession,
|
||||
|
|
@ -56,6 +56,7 @@ impl Server {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(unreachable_code)]
|
||||
pub fn handle_request(&self, request: &Request) -> Response {
|
||||
router!(request,
|
||||
(GET) (/) => {
|
||||
|
|
@ -153,7 +154,6 @@ impl Server {
|
|||
)
|
||||
}
|
||||
|
||||
// #[allow(unreachable_code)]
|
||||
pub fn listen(self, port: u64) {
|
||||
let address = format!("localhost:{}", port);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue