forked from MapComplete/MapComplete
		
	Merge branch 'develop'
This commit is contained in:
		
						commit
						9cb2eb75a6
					
				
					 5 changed files with 18 additions and 21 deletions
				
			
		|  | @ -26,8 +26,12 @@ Use `vite-node ./scripts/osm2pgsql/generateBuildDbScript.ts` | ||||||
| ## Importing data | ## Importing data | ||||||
| 
 | 
 | ||||||
| Install osm2pgsql (hint: compile from source is painless) | Install osm2pgsql (hint: compile from source is painless) | ||||||
| To seed the database: |  | ||||||
| 
 | 
 | ||||||
|  | Download the latest with: | ||||||
|  | `nohup transmission-cli https://planet.osm.org/pbf/planet-latest.osm.pbf.torrent &>nohup_transmission.log &` | ||||||
|  | which will download the data to `~/Downloads` | ||||||
|  | 
 | ||||||
|  | To seed the database: | ||||||
| ```` | ```` | ||||||
| osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi <file>.osm.pbf  | osm2pgsql -O flex -S build_db.lua -s --flat-nodes=import-help-file -d postgresql://user:password@localhost:5444/osm-poi <file>.osm.pbf  | ||||||
| ```` | ```` | ||||||
|  | @ -49,6 +53,7 @@ HP ProLiant DL360 G7 (1U): 2Rx4 DDR3-memory (PC3) | ||||||
| 
 | 
 | ||||||
| ## Updating data | ## Updating data | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
| `osm2pgsql-replication update -d postgresql://user:password@localhost:5444/osm-poi -- -O flex -S build_db.lua -s --flat-nodes=import-help-file` | `osm2pgsql-replication update -d postgresql://user:password@localhost:5444/osm-poi -- -O flex -S build_db.lua -s --flat-nodes=import-help-file` | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -38,9 +38,8 @@ | ||||||
|         } |         } | ||||||
|       }, |       }, | ||||||
|       "minzoom": 10, |       "minzoom": 10, | ||||||
|       "allowMove": { |       "#allowMove": "Normally, a ghost sign is snapped to a wall, so moving won't be possible in most cases", | ||||||
|         "enableImproveAccuracy": true |       "allowMove": false, | ||||||
|       }, |  | ||||||
|       "tagRenderings": [ |       "tagRenderings": [ | ||||||
|         { |         { | ||||||
|           "id": "historic", |           "id": "historic", | ||||||
|  |  | ||||||
|  | @ -12,7 +12,6 @@ import SpecialVisualizations from "../src/UI/SpecialVisualizations" | ||||||
| import Constants from "../src/Models/Constants" | import Constants from "../src/Models/Constants" | ||||||
| import { AvailableRasterLayers, RasterLayerPolygon } from "../src/Models/RasterLayers" | import { AvailableRasterLayers, RasterLayerPolygon } from "../src/Models/RasterLayers" | ||||||
| import { ImmutableStore } from "../src/Logic/UIEventSource" | import { ImmutableStore } from "../src/Logic/UIEventSource" | ||||||
| import * as crypto from "crypto" |  | ||||||
| import * as eli from "../src/assets/editor-layer-index.json" | import * as eli from "../src/assets/editor-layer-index.json" | ||||||
| import * as eli_global from "../src/assets/global-raster-layers.json" | import * as eli_global from "../src/assets/global-raster-layers.json" | ||||||
| import ValidationUtils from "../src/Models/ThemeConfig/Conversion/ValidationUtils" | import ValidationUtils from "../src/Models/ThemeConfig/Conversion/ValidationUtils" | ||||||
|  | @ -374,15 +373,6 @@ async function generateCsp( | ||||||
|     ].join("\n") |     ].join("\n") | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| const removeOtherLanguages = readFileSync("./src/UI/RemoveOtherLanguages.js", "utf8") |  | ||||||
|     .split("\n") |  | ||||||
|     .map((s) => s.trim()) |  | ||||||
|     .join("\n") |  | ||||||
| const removeOtherLanguagesHash = crypto |  | ||||||
|     .createHash("sha256") |  | ||||||
|     .update(removeOtherLanguages) |  | ||||||
|     .digest("base64") |  | ||||||
| 
 |  | ||||||
| async function createLandingPage( | async function createLandingPage( | ||||||
|     layout: LayoutConfig, |     layout: LayoutConfig, | ||||||
|     layoutJson: LayoutConfigJson, |     layoutJson: LayoutConfigJson, | ||||||
|  | @ -461,9 +451,6 @@ async function createLandingPage( | ||||||
| 
 | 
 | ||||||
|     const loadingText = Translations.t.general.loadingTheme.Subs({ theme: layout.title }) |     const loadingText = Translations.t.general.loadingTheme.Subs({ theme: layout.title }) | ||||||
|     const templateLines = template.split("\n") |     const templateLines = template.split("\n") | ||||||
|     const removeOtherLanguagesReference = templateLines.find( |  | ||||||
|         (line) => line.indexOf("./src/UI/RemoveOtherLanguages.js") >= 0 |  | ||||||
|     ) |  | ||||||
|     let output = template |     let output = template | ||||||
|         .replace("Loading MapComplete, hang on...", asLangSpan(loadingText, "h1")) |         .replace("Loading MapComplete, hang on...", asLangSpan(loadingText, "h1")) | ||||||
|         .replace( |         .replace( | ||||||
|  | @ -474,10 +461,9 @@ async function createLandingPage( | ||||||
|         .replace( |         .replace( | ||||||
|             /<!-- CSP -->/, |             /<!-- CSP -->/, | ||||||
|             await generateCsp(layout, layoutJson, { |             await generateCsp(layout, layoutJson, { | ||||||
|                 scriptSrcs: [`'sha256-${removeOtherLanguagesHash}'`], |                 scriptSrcs: [], | ||||||
|             }) |             }) | ||||||
|         ) |         ) | ||||||
|         .replace(removeOtherLanguagesReference, "<script>" + removeOtherLanguages + "</script>") |  | ||||||
|         .replace( |         .replace( | ||||||
|             /<!-- DESCRIPTION START -->.*<!-- DESCRIPTION END -->/s, |             /<!-- DESCRIPTION START -->.*<!-- DESCRIPTION END -->/s, | ||||||
|             asLangSpan(layout.shortDescription) |             asLangSpan(layout.shortDescription) | ||||||
|  |  | ||||||
|  | @ -85,9 +85,15 @@ export class Imgur extends ImageProvider implements ImageUploader { | ||||||
|      * expected.date = new Date(1655052078000) |      * expected.date = new Date(1655052078000) | ||||||
|      * expected.views = 2 |      * expected.views = 2 | ||||||
|      * licenseInfo // => expected
 |      * licenseInfo // => expected
 | ||||||
|  |      * const licenseInfoJpeg = await Imgur.singleton.DownloadAttribution("https://i.imgur.com/E0RuAK3.jpeg") | ||||||
|  |      * licenseInfoJpeg // => expected
 | ||||||
|  |      * const licenseInfoUpperCase = await Imgur.singleton.DownloadAttribution("https://i.imgur.com/E0RuAK3.JPEG") | ||||||
|  |      * licenseInfoUpperCase // => expected
 | ||||||
|  |      * | ||||||
|  |      * | ||||||
|      */ |      */ | ||||||
|     public async DownloadAttribution(url: string): Promise<LicenseInfo> { |     public async DownloadAttribution(url: string): Promise<LicenseInfo> { | ||||||
|         const hash = url.substr("https://i.imgur.com/".length).split(".jpg")[0] |         const hash = url.substr("https://i.imgur.com/".length).split(/\.jpe?g/i)[0] | ||||||
| 
 | 
 | ||||||
|         const apiUrl = "https://api.imgur.com/3/image/" + hash |         const apiUrl = "https://api.imgur.com/3/image/" + hash | ||||||
|         const response = await Utils.downloadJsonCached(apiUrl, 365 * 24 * 60 * 60, { |         const response = await Utils.downloadJsonCached(apiUrl, 365 * 24 * 60 * 60, { | ||||||
|  |  | ||||||
|  | @ -134,9 +134,10 @@ export class MoveWizardState { | ||||||
|             // This is a new point. Check if it was snapped to an existing way due to the '_referencing_ways'-tag
 |             // This is a new point. Check if it was snapped to an existing way due to the '_referencing_ways'-tag
 | ||||||
|             const store = this._state.featureProperties.getStore(id) |             const store = this._state.featureProperties.getStore(id) | ||||||
|             store?.addCallbackAndRunD((tags) => { |             store?.addCallbackAndRunD((tags) => { | ||||||
|                 if (tags._referencing_ways !== "[]") { |                 if (tags._referencing_ways !== undefined && tags._referencing_ways !== "[]") { | ||||||
|                     console.log("Got referencing ways according to the tags") |                     console.log("Got referencing ways according to the tags") | ||||||
|                     this.moveDisallowedReason.setData(t.partOfAWay) |                     this.moveDisallowedReason.setData(t.partOfAWay) | ||||||
|  |                     return true | ||||||
|                 } |                 } | ||||||
|             }) |             }) | ||||||
|         } |         } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue