forked from MapComplete/MapComplete
		
	Merge branch 'master' of source.mapcomplete.org:mapcomplete/mapcomplete
This commit is contained in:
		
						commit
						8d6f9ea94f
					
				
					 7 changed files with 47 additions and 20 deletions
				
			
		
							
								
								
									
										15
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										15
									
								
								package-lock.json
									
										
									
										generated
									
									
									
								
							|  | @ -1,4 +1,3 @@ | |||
| { | ||||
|   "name": "mapcomplete", | ||||
|   "version": "0.51.1", | ||||
|   "lockfileVersion": 2, | ||||
|  | @ -67,7 +66,7 @@ | |||
|         "marked": "^12.0.2", | ||||
|         "monaco-editor": "^0.46.0", | ||||
|         "mvt-to-geojson": "^0.0.6", | ||||
|         "name-suggestion-index": "^6.0.20250302", | ||||
|         "name-suggestion-index": "^6.0.20250413", | ||||
|         "npm": "^11.1.0", | ||||
|         "opening_hours": "^3.6.0", | ||||
|         "osm-auth": "^2.6.0", | ||||
|  | @ -20056,9 +20055,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "node_modules/name-suggestion-index": { | ||||
|       "version": "6.0.20250302", | ||||
|       "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250302.tgz", | ||||
|       "integrity": "sha512-9tdHRaHBXhFTXCt0FGWhOuIRWx8GalsbTD2GIL9B8XmFah8q6hk99yjMMnRkRAedarvJpYHaUCSbkaH6QQpplA==", | ||||
|       "version": "6.0.20250413", | ||||
|       "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250413.tgz", | ||||
|       "integrity": "sha512-rJ+6A2pp/NQ9gidWs72XuVBlfzynF4IaoeOFhKX19fCQbVNHiWbxlTSxQ852pQoisJXDSW5kgzakoKz7uxo9BA==", | ||||
|       "license": "BSD-3-Clause", | ||||
|       "dependencies": { | ||||
|         "diacritics": "^1.3.0", | ||||
|  | @ -44340,9 +44339,9 @@ | |||
|       } | ||||
|     }, | ||||
|     "name-suggestion-index": { | ||||
|       "version": "6.0.20250302", | ||||
|       "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250302.tgz", | ||||
|       "integrity": "sha512-9tdHRaHBXhFTXCt0FGWhOuIRWx8GalsbTD2GIL9B8XmFah8q6hk99yjMMnRkRAedarvJpYHaUCSbkaH6QQpplA==", | ||||
|       "version": "6.0.20250413", | ||||
|       "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250413.tgz", | ||||
|       "integrity": "sha512-rJ+6A2pp/NQ9gidWs72XuVBlfzynF4IaoeOFhKX19fCQbVNHiWbxlTSxQ852pQoisJXDSW5kgzakoKz7uxo9BA==", | ||||
|       "requires": { | ||||
|         "diacritics": "^1.3.0", | ||||
|         "run-s": "^0.0.0", | ||||
|  |  | |||
|  | @ -37,6 +37,8 @@ | |||
|     "summary_server": "https://cache.mapcomplete.org/", | ||||
|     "geoip_server": "https://ipinfo.mapcomplete.org/", | ||||
|     "error_server": "https://report.mapcomplete.org/report", | ||||
|     "#nsi_logos_server": "The location where a running instance of MapComplete will fetch the NSI-logos. This is by default the host itself, but not in e.g. the android app", | ||||
|     "nsi_logos_server": "https://mapcomplete.org/assets/data/nsi/", | ||||
|     "api_keys": { | ||||
|       "#": "Various API-keys for various services. Feel free to reuse those in another MapComplete-hosted version", | ||||
|       "#fork": "Not bound to a domain; can be reused", | ||||
|  | @ -111,7 +113,7 @@ | |||
|     "generate": "npm run generate:licenses && npm run generate:images && npm run generate:charging-stations && npm run generate:translations && npm run refresh:layeroverview && npm run generate:service-worker", | ||||
|     "generate:charging-stations": "cd ./assets/layers/charging_station && vite-node csvToJson.ts && cd -", | ||||
|     "clean:tests": "find . -type f -name \"*.doctest.ts\" | xargs -r rm", | ||||
|     "clean": "rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|privacy\\|test\\|studio\\|theme\\|style_test\\|statistics\\|status\\|leaderboard\\|inspector\\).html\" | xargs -r rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs -r rm)", | ||||
|     "clean": "echo '{\n  \"#\": \"Settings in this file override the `config`-section of `package.json`\"\n}' > config.json && rm -rf .cache/ && (find *.html | grep -v \"^\\(404\\|index\\|land\\|privacy\\|test\\|studio\\|theme\\|style_test\\|statistics\\|status\\|leaderboard\\|inspector\\).html\" | xargs -r rm) && (ls | grep \"^index_[a-zA-Z_-]\\+\\.ts$\" | xargs -r rm)", | ||||
|     "generate:dependency-graph": "node_modules/.bin/depcruise --exclude \"^node_modules\" --output-type dot Logic/State/MapState.ts > dependencies.dot && dot dependencies.dot -T svg -o dependencies.svg && rm dependencies.dot", | ||||
|     "scrapeWebsites": "vite-node scripts/importscripts/compareWebsiteData.ts -- ~/Downloads/ShopsWithWebsiteNodes.csv ~/data/scraped_websites/", | ||||
|     "### 0": "VELOPARK", | ||||
|  | @ -229,7 +231,7 @@ | |||
|     "marked": "^12.0.2", | ||||
|     "monaco-editor": "^0.46.0", | ||||
|     "mvt-to-geojson": "^0.0.6", | ||||
|     "name-suggestion-index": "^6.0.20250302", | ||||
|     "name-suggestion-index": "^6.0.20250413", | ||||
|     "npm": "^11.1.0", | ||||
|     "opening_hours": "^3.6.0", | ||||
|     "osm-auth": "^2.6.0", | ||||
|  |  | |||
|  | @ -126,7 +126,7 @@ class DownloadEli extends Script { | |||
|         fs.writeFileSync(targetGlobal, JSON.stringify(contentsGlobal, null, "  "), { | ||||
|             encoding: "utf8", | ||||
|         }) | ||||
|         console.log("Written", keptGlobalLayers.length + ", entries to the global ELI") | ||||
|         console.log("Written", keptGlobalLayers.length + ", entries to the global ELI ("+targetGlobal+")") | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -211,7 +211,7 @@ class NsiLogos extends Script { | |||
|         const config: LayerConfigJson = { | ||||
|             id: "nsi_" + type, | ||||
|             description: { | ||||
|                 en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering", | ||||
|                 en: "Exposes part of the NSI to reuse in other themes, e.g. for rendering. Automatically generated and never directly loaded in a theme", | ||||
|             }, | ||||
|             source: "special:library", | ||||
|             pointRendering: null, | ||||
|  |  | |||
|  | @ -8,7 +8,18 @@ then | |||
|   npm run generate:layeroverview | ||||
|   npm run generate:layouts | ||||
| fi | ||||
| vite-node scripts/nsiLogos.ts -- patch | ||||
| echo ''' | ||||
| { | ||||
|     "nsi_logos_server": "https://mapcomplete.org/assets/data/nsi/logos/" | ||||
| } | ||||
| ''' > config.json | ||||
| cat config.json | jq | ||||
| if [ $? -ne 0 ] | ||||
| then | ||||
|   echo "config.json file is invalid, exiting now" | ||||
|   tput bel | ||||
|   exit 0 | ||||
| fi | ||||
| npm run build | ||||
| echo ''' | ||||
| import type { CapacitorConfig } from "@capacitor/cli"; | ||||
|  | @ -22,6 +33,7 @@ const config: CapacitorConfig = { | |||
| export default config; | ||||
| ''' > capacitor.config.ts | ||||
| 
 | ||||
| 
 | ||||
| # copy distribution files | ||||
| rm -rf dist-full | ||||
| mkdir dist-full | ||||
|  | @ -51,6 +63,11 @@ cp -r dist/assets/svg dist-full/assets/ | |||
| cp -r dist/assets/templates dist-full/assets/ | ||||
| cp -r dist/assets/generated/themes/ dist-full/assets/generated/ | ||||
| cp -r dist/assets/themes dist-full/assets/ | ||||
| cp dist/assets/*.js.map dist-full/assets/ | ||||
| rm -rf dist-full/assets/data/nsi | ||||
| rm /home/pietervdvn/git/MapComplete/dist-full/assets/layers/nsi_brand/nsi_brand.json | ||||
| rm /home/pietervdvn/git/MapComplete/dist-full/assets/layers/nsi_operator/nsi_operator.json | ||||
| 
 | ||||
| # mkdir dist-full/assets/generated | ||||
| nvm use | ||||
| 
 | ||||
|  | @ -59,7 +76,8 @@ nvm use | |||
| npx capacitor-assets generate | ||||
| 
 | ||||
| npx cap sync | ||||
| cd android | ||||
| npm run clean | ||||
| 
 | ||||
| echo "All done! Don't forget to click 'gradle sync files' in Android Studio" | ||||
| tput bel | ||||
| tput bel | ||||
|  |  | |||
|  | @ -8,6 +8,7 @@ import { TypedTranslation } from "../../UI/i18n/Translation" | |||
| import { RegexTag } from "../Tags/RegexTag" | ||||
| import { TagConfigJson } from "../../Models/ThemeConfig/Json/TagConfigJson" | ||||
| import { TagUtils } from "../Tags/TagUtils" | ||||
| import Constants from "../../Models/Constants" | ||||
| 
 | ||||
| /** | ||||
|  * Main name suggestion index file | ||||
|  | @ -69,8 +70,10 @@ export default class NameSuggestionIndex { | |||
|     private loco: LocationConflation // Some additional boundaries
 | ||||
| 
 | ||||
|     private _supportedTypes: string[] | ||||
|     private _serverLocation: string | ||||
| 
 | ||||
|     constructor( | ||||
|     private constructor( | ||||
|         serverLocation: string, | ||||
|         nsiFile: Readonly<NSIFile>, | ||||
|         nsiWdFile: Readonly< | ||||
|             Record< | ||||
|  | @ -82,6 +85,7 @@ export default class NameSuggestionIndex { | |||
|         >, | ||||
|         features: Readonly<FeatureCollection> | ||||
|     ) { | ||||
|         this._serverLocation = serverLocation | ||||
|         this.nsiFile = nsiFile | ||||
|         this.nsiWdFile = nsiWdFile | ||||
|         this.loco = new LocationConflation(features) | ||||
|  | @ -101,6 +105,7 @@ export default class NameSuggestionIndex { | |||
|             ].map((url) => Utils.downloadJsonCached(url, 1000 * 60 * 60 * 24 * 30)) | ||||
|         ) | ||||
|         NameSuggestionIndex.inited = new NameSuggestionIndex( | ||||
|             Constants.nsiLogosEndpoint, | ||||
|             <any>nsi, | ||||
|             <any>nsiWd["wikidata"], | ||||
|             <any>features | ||||
|  | @ -129,12 +134,13 @@ export default class NameSuggestionIndex { | |||
|      * @param countries | ||||
|      * @private | ||||
|      */ | ||||
|     private static async fetchFrequenciesFor(type: string, countries: string[]) { | ||||
|     private async fetchFrequenciesFor(type: string, countries: string[]) { | ||||
|         const server = this._serverLocation | ||||
|         let stats = await Promise.all( | ||||
|             countries.map((c) => { | ||||
|                 try { | ||||
|                     return Utils.downloadJsonCached<Record<string, number>>( | ||||
|                         `./assets/data/nsi/stats/${type}.${c.toUpperCase()}.json`, | ||||
|                         `${server}/stats/${type}.${c.toUpperCase()}.json`, | ||||
|                         24 * 60 * 60 * 1000 | ||||
|                     ) | ||||
|                 } catch (e) { | ||||
|  | @ -194,7 +200,7 @@ export default class NameSuggestionIndex { | |||
|         const mappings: (Mapping & { frequency: number })[] = [] | ||||
|         const frequencies = | ||||
|             country !== undefined | ||||
|                 ? await NameSuggestionIndex.fetchFrequenciesFor(type, country) | ||||
|                 ? await this.fetchFrequenciesFor(type, country) | ||||
|                 : {} | ||||
|         for (const key in tags) { | ||||
|             if (key.startsWith("_")) { | ||||
|  | @ -398,11 +404,12 @@ export default class NameSuggestionIndex { | |||
|     } | ||||
| 
 | ||||
|     public getIconUrl(nsiItem: NSIItem): string | undefined { | ||||
|         if (!nsiItem.ext) { | ||||
|         const baseUrl = this._serverLocation | ||||
|         if (!nsiItem.ext || baseUrl === null) { | ||||
|             // No extension -> there is no logo
 | ||||
|             return undefined | ||||
|         } | ||||
|         return "./assets/data/nsi/logos/" + nsiItem.id + "." + nsiItem.ext | ||||
|         return baseUrl +"/logos/"+ nsiItem.id + "." + nsiItem.ext | ||||
|     } | ||||
| 
 | ||||
|     private static readonly brandPrefix = ["name", "alt_name", "operator", "brand"] as const | ||||
|  |  | |||
|  | @ -139,6 +139,7 @@ export default class Constants { | |||
|     public static osmAuthConfig: AuthConfig = Constants.config.oauth_credentials | ||||
|     public static nominatimEndpoint: string = Constants.config.nominatimEndpoint | ||||
|     public static photonEndpoint: string = Constants.config.photonEndpoint | ||||
|     public static nsiLogosEndpoint: string = Constants.config.nsi_logos_server ?? null | ||||
|     public static weblate: string = "https://translate.mapcomplete.org/" | ||||
| 
 | ||||
|     public static linkedDataProxy: string = Constants.config["jsonld-proxy"] | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue