diff --git a/chunkymap-regen.py b/chunkymap-regen.py index 7b8dcf4..3ed764e 100644 --- a/chunkymap-regen.py +++ b/chunkymap-regen.py @@ -331,6 +331,7 @@ class MTChunk: class MTChunks: chunkymap_data_path = None + chunkymapdata_worlds_path = None is_save_output_ok = None minetestmapper_fast_sqlite_path = None minetestmapper_custom_path = None @@ -575,6 +576,7 @@ class MTChunks: sys.exit() self.chunkymap_data_path=os.path.join(self.config["www_minetest_path"],"chunkymapdata") + self.chunkymapdata_worlds_path=os.path.join(self.chunkymap_data_path, "worlds") print("Using chunkymap_data_path '"+self.chunkymap_data_path+"'") #if not os.path.isdir(self.chunkymap_data_path): # os.mkdir(self.chunkymap_data_path) @@ -586,8 +588,18 @@ class MTChunks: self.deny_http_access(self.chunkymap_data_path) print(" (created .htaccess)") + htaccess_path = os.path.join(self.chunkymapdata_worlds_path,".htaccess") + if not os.path.isdir(self.chunkymapdata_worlds_path): + os.makedirs(self.chunkymapdata_worlds_path) + print("Created '"+self.chunkymapdata_worlds_path+"'") + if not os.path.isfile(htaccess_path): + self.deny_http_access(self.chunkymapdata_worlds_path) + print(" (created .htaccess)") + + + self.world_name = os.path.basename(self.config["world_path"]) - self.chunkymap_thisworld_data_path = os.path.join(self.chunkymap_data_path, self.world_name) + self.chunkymap_thisworld_data_path = os.path.join(self.chunkymapdata_worlds_path, self.world_name) if not os.path.isdir(self.chunkymap_thisworld_data_path): os.makedirs(self.chunkymap_thisworld_data_path) print("Created '"+self.chunkymap_thisworld_data_path+"'") @@ -614,7 +626,7 @@ class MTChunks: #TODO: deny recursively under these folders? doesn't seem that important for security so maybe not (no player info is there) - self.install_website() + self.install_default_world_data() self.chunkymap_players_name = "players" self.chunkymap_players_path = os.path.join(self.chunkymap_thisworld_data_path, self.chunkymap_players_name) @@ -683,22 +695,34 @@ class MTChunks: if is_config_changed: self.save_config() - def install_website(self): - this_source_dir_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web") - this_dest_dir_path = self.config["www_minetest_path"] + #def install_default_world_data(self): + #source_web_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web") + #dest_web_chunkymapdata_world_path = self.chunkymap_thisworld_data_path + #dest_web_chunkymapdata_world_players_path = os.path.join(self.chunkymap_thisworld_data_path, "players") + #install_list.append(InstalledFile("singleplayer.png", source_chunkymapdata_players, dest_chunkymapdata_players)) + + + #formerly install_website + def install_default_world_data(self): + source_web_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "web") + source_web_chunkymapdata_path = os.path.join(source_web_path, "chunkymapdata_default") + source_web_chunkymapdata_world_path = os.path.join(source_web_chunkymapdata_path, "world") + source_web_chunkymapdata_images_path = os.path.join(source_web_chunkymapdata_path, "images") + dest_web_path = self.config["www_minetest_path"] + dest_web_chunkymapdata_path = os.path.join(self.config["www_minetest_path"],"chunkymapdata") + dest_web_chunkymapdata_images_path = os.path.join(dest_web_chunkymapdata_path,"images") install_list = list() - install_list.append(InstalledFile("browser.php",this_source_dir_path,this_dest_dir_path)) - install_list.append(InstalledFile("chunkymap.php",this_source_dir_path,this_dest_dir_path)) - install_list.append(InstalledFile("example.php",this_source_dir_path,this_dest_dir_path)) - source_web_images_path = os.path.join( os.path.join(os.path.dirname(os.path.abspath(self.minetestmapper_py_path)), "web"), "images") - dest_web_images_path = os.path.join( self.config["www_minetest_path"], "images") - install_list.append(InstalledFile("chunkymap_zoom-in.png", source_web_images_path, dest_web_images_path)) - install_list.append(InstalledFile("chunkymap_zoom-out.png", source_web_images_path, dest_web_images_path)) - install_list.append(InstalledFile("chunkymap_zoom-in_disabled.png", source_web_images_path, dest_web_images_path)) - install_list.append(InstalledFile("chunkymap_zoom-out_disabled.png", source_web_images_path, dest_web_images_path)) - install_list.append(InstalledFile("chunkymap_start.png", source_web_images_path, dest_web_images_path)) - source_chunkymapdata = os.path.join( os.path.join(os.path.dirname(os.path.abspath(self.minetestmapper_py_path)), "web"), "chunkymapdata_default") - source_chunkymapdata_players = os.path.join(source_chunkymapdata, "players") + install_list.append(InstalledFile("browser.php",source_web_path,dest_web_path)) + install_list.append(InstalledFile("chunkymap.php",source_web_path,dest_web_path)) + install_list.append(InstalledFile("example.php",source_web_path,dest_web_path)) + install_list.append(InstalledFile("zoom-in.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("zoom-out.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("zoom-in_disabled.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("zoom-out_disabled.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("start.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("target_start.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + install_list.append(InstalledFile("compass-rose.png", source_web_chunkymapdata_images_path, dest_web_chunkymapdata_images_path)) + source_chunkymapdata_players = os.path.join(source_web_chunkymapdata_world_path, "players") dest_chunkymapdata_players = os.path.join(self.chunkymap_thisworld_data_path, "players") install_list.append(InstalledFile("singleplayer.png", source_chunkymapdata_players, dest_chunkymapdata_players)) for this_object in install_list: diff --git a/etc/compass-rose.xcf b/etc/compass-rose.xcf new file mode 100644 index 0000000..c97c9dd Binary files /dev/null and b/etc/compass-rose.xcf differ diff --git a/web/chunkymap.php b/web/chunkymap.php index 6969dbf..a5f2da5 100644 --- a/web/chunkymap.php +++ b/web/chunkymap.php @@ -37,8 +37,8 @@ if (!isset($chunkymap_view_zoom_multiplier)) { $chunkymap_view_zoom_multiplier=.25; } -// OPTIONAL: $chunkymapdata_path = "chunkymapdata"; +$chunkymapdata_worlds_path = $chunkymapdata_path."/worlds"; $chunkymapdata_thisworld_path = null; $showplayers=true; @@ -137,8 +137,8 @@ function echo_chunkymap_controls($callback_php_path) { global $chunkymap_anchor_name; $is_in=false; $is_out=false; - $in_img_name = "chunkymap_zoom-in.png"; - $out_img_name = "chunkymap_zoom-out.png"; + $in_img_name = "zoom-in.png"; + $out_img_name = "zoom-out.png"; $in_zoom = $chunkymap_view_zoom_multiplier; if ($in_zoom<$chunkymap_view_zoom_max) { @@ -146,14 +146,14 @@ function echo_chunkymap_controls($callback_php_path) { $in_zoom = $chunkymap_view_zoom_multiplier*2.0; //echo "in:$in_zoom "; } - else $in_img_name = "chunkymap_zoom-in_disabled.png"; + else $in_img_name = "zoom-in_disabled.png"; $out_zoom = $chunkymap_view_zoom_multiplier; if ($out_zoom>$chunkymap_view_zoom_min) { $is_out=true; $out_zoom = ($chunkymap_view_zoom_multiplier/2.0); } - else $out_img_name = "chunkymap_zoom-out_disabled.png"; + else $out_img_name = "zoom-out_disabled.png"; $zoom_clip = $chunkymap_view_zoom_max; $found=false; @@ -206,8 +206,8 @@ function echo_chunkymap_controls($callback_php_path) { } if (!$found) $in_zoom=$chunkymap_view_zoom_max; - $in_html=""; - $out_html=""; + $in_html=""; + $out_html=""; global $world_name; $append_vars="&"; if (isset($world_name)) { @@ -287,6 +287,7 @@ function echo_entire_chunkymap_as_chunk_table() { global $chunkymap_view_zoom_max; global $chunkymap_view_zoom_min; global $chunkymapdata_path; + global $chunkymapdata_worlds_path; global $map_dict; global $is_verbose; global $chunkymap_tile_original_w; @@ -313,7 +314,7 @@ function echo_entire_chunkymap_as_chunk_table() { $character_icon_h=8; global $chunkymapdata_thisworld_path; if (isset($world_name)) { - $chunkymapdata_thisworld_path = $chunkymapdata_path."/".$world_name; + $chunkymapdata_thisworld_path = $chunkymapdata_worlds_path."/".$world_name; $generated_yml_path = $chunkymapdata_thisworld_path."/generated.yml"; if (is_file($generated_yml_path)) { $map_dict = get_dict_from_conf($generated_yml_path,":"); @@ -630,7 +631,7 @@ function echo_entire_chunkymap_as_chunk_table() { $img_style.="opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below $text_style="color:white; opacity: 0.4; filter: alpha(opacity=40);"; //filter is for IE8 and below } - echo_hold( "
$player_name
" ); + echo_hold( "
$player_name
" ); } //$position_offset_x+=$character_icon_w; } @@ -653,7 +654,7 @@ function echo_entire_chunkymap_as_chunk_table() { else { //not isset($world_name) echo "

Choose world:

"; echo "