This repository was archived by the owner on Sep 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 9 files changed +23
-13
lines changed
Expand file tree Collapse file tree 9 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 11port = 8080
22two_way_sync = [
33 " ServerStorage" ,
4- " ReplicatedStorage"
5- ]
4+ " ReplicatedStorage/SearchThis"
5+ ]
6+ two_way_descendants = false
Original file line number Diff line number Diff line change 11{
2- "data" : " Hello from CreeperCLI (json/module) "
2+ "data" : " Hello from creeperCLI (json)a "
33}
Original file line number Diff line number Diff line change 1+ data = " hello world"
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -44,9 +44,9 @@ pub fn get_tree(root: &str) -> Vec<FileTree> {
4444 tree
4545}
4646
47- pub fn get_game_files ( ) -> Vec < FileTree > {
47+ pub fn get_root_files ( root : & str ) -> Vec < FileTree > {
4848 let cwd = get_cwd ( ) ;
49- let game = format ! ( "{cwd}\\ game " ) ;
49+ let game = format ! ( "{cwd}\\ {root} " ) ;
5050 get_tree ( game. as_str ( ) )
5151}
5252
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ lazy_static! {
1010}
1111
1212pub async fn get ( ) -> impl Responder {
13- let mut tree = filesystem:: get_game_files ( ) ;
13+ let mut tree = filesystem:: get_root_files ( "game" ) ;
1414
1515 let mut data = match GLOBAL_DATA . lock ( ) {
1616 Ok ( guard) => guard,
Original file line number Diff line number Diff line change 11use colored:: Colorize ;
2+ use toml:: Table ;
23use std:: { io:: stdin, path:: Path } ;
3-
44use filesystem:: get_cwd;
55use server:: run_server;
6+ use lazy_static:: lazy_static;
7+ use std:: sync:: Mutex ;
68
79mod filesystem;
810mod get;
911mod post;
1012mod server;
1113mod settings;
1214
15+ lazy_static ! {
16+ pub static ref DIRECTORIES : Mutex <Table > = Mutex :: new( Table :: new( ) ) ;
17+ }
18+
1319#[ actix_web:: main]
1420async fn main ( ) -> std:: io:: Result < ( ) > {
1521 let cwd = get_cwd ( ) ;
@@ -21,6 +27,13 @@ async fn main() -> std::io::Result<()> {
2127 for ( name, value) in settings. iter ( ) {
2228 match name. to_lowercase ( ) . as_str ( ) {
2329 "port" => port = value. as_integer ( ) . unwrap_or ( 8080 ) as u16 ,
30+ "directories" => {
31+ let mut data = match DIRECTORIES . lock ( ) {
32+ Ok ( guard) => guard,
33+ Err ( poisoned) => poisoned. into_inner ( ) , // Recover from poisoned mutex
34+ } ;
35+ * data = value. as_table ( ) . unwrap_or ( & Table :: new ( ) ) . clone ( ) ;
36+ } ,
2437 _ => { }
2538 }
2639 }
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ pub async fn post(body: String) -> impl Responder {
2222
2323 return HttpResponse :: Ok ( )
2424 . append_header ( ( header:: CONTENT_TYPE , "application/json" ) )
25- . body ( map_tree ( filesystem:: get_game_files ( ) ) ) ;
25+ . body ( map_tree ( filesystem:: get_root_files ( "game" ) ) ) ;
2626 } else if data[ 0 ] == "__SETTINGS__" {
2727 let cwd = get_cwd ( ) ;
2828 if let Ok ( settings) = get_settings ( & cwd) {
You can’t perform that action at this time.
0 commit comments