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::{
|
||||||
use std::process;
|
path::Path,
|
||||||
use std::fs;
|
process,
|
||||||
|
sync::Arc,
|
||||||
|
};
|
||||||
|
|
||||||
use rand;
|
use ::{
|
||||||
|
project::Project,
|
||||||
use project::Project;
|
web::Server,
|
||||||
// use web::{self, WebConfig};
|
serve_session::ServeSession,
|
||||||
// use session::Session;
|
roblox_studio,
|
||||||
use roblox_studio;
|
};
|
||||||
|
|
||||||
pub fn serve(fuzzy_project_location: &Path) {
|
pub fn serve(fuzzy_project_location: &Path) {
|
||||||
let server_id = rand::random::<u64>();
|
|
||||||
|
|
||||||
let project = match Project::load_fuzzy(fuzzy_project_location) {
|
let project = match Project::load_fuzzy(fuzzy_project_location) {
|
||||||
Ok(project) => {
|
Ok(project) => project,
|
||||||
println!("Using project from {}", fs::canonicalize(&project.file_location).unwrap().display());
|
|
||||||
project
|
|
||||||
},
|
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
eprintln!("{}", error);
|
eprintln!("Fatal: {}", error);
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
println!("Found project at {}", project.file_location.display());
|
||||||
println!("Using project {:#?}", project);
|
println!("Using project {:#?}", project);
|
||||||
|
|
||||||
roblox_studio::install_bundled_plugin().unwrap();
|
roblox_studio::install_bundled_plugin().unwrap();
|
||||||
|
|
||||||
// let mut session = Session::new(project.clone());
|
let session = Arc::new(ServeSession::new(project));
|
||||||
// session.start();
|
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::borrow::Cow;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::{mpsc, RwLock, Arc};
|
use std::sync::{mpsc, Arc};
|
||||||
|
|
||||||
use rouille::{self, Request, Response};
|
use rouille::{self, Request, Response};
|
||||||
use rand;
|
use rand;
|
||||||
|
|
||||||
use ::{
|
use ::{
|
||||||
id::Id,
|
id::Id,
|
||||||
message_session::{MessageSession, Message},
|
message_session::Message,
|
||||||
project::Project,
|
project::Project,
|
||||||
rbx::RbxInstance,
|
rbx::RbxInstance,
|
||||||
serve_session::ServeSession,
|
serve_session::ServeSession,
|
||||||
|
|
@ -56,6 +56,7 @@ impl Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unreachable_code)]
|
||||||
pub fn handle_request(&self, request: &Request) -> Response {
|
pub fn handle_request(&self, request: &Request) -> Response {
|
||||||
router!(request,
|
router!(request,
|
||||||
(GET) (/) => {
|
(GET) (/) => {
|
||||||
|
|
@ -153,7 +154,6 @@ impl Server {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[allow(unreachable_code)]
|
|
||||||
pub fn listen(self, port: u64) {
|
pub fn listen(self, port: u64) {
|
||||||
let address = format!("localhost:{}", port);
|
let address = format!("localhost:{}", port);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue