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",
 | 
					  "name": "mapcomplete",
 | 
				
			||||||
  "version": "0.51.1",
 | 
					  "version": "0.51.1",
 | 
				
			||||||
  "lockfileVersion": 2,
 | 
					  "lockfileVersion": 2,
 | 
				
			||||||
| 
						 | 
					@ -67,7 +66,7 @@
 | 
				
			||||||
        "marked": "^12.0.2",
 | 
					        "marked": "^12.0.2",
 | 
				
			||||||
        "monaco-editor": "^0.46.0",
 | 
					        "monaco-editor": "^0.46.0",
 | 
				
			||||||
        "mvt-to-geojson": "^0.0.6",
 | 
					        "mvt-to-geojson": "^0.0.6",
 | 
				
			||||||
        "name-suggestion-index": "^6.0.20250302",
 | 
					        "name-suggestion-index": "^6.0.20250413",
 | 
				
			||||||
        "npm": "^11.1.0",
 | 
					        "npm": "^11.1.0",
 | 
				
			||||||
        "opening_hours": "^3.6.0",
 | 
					        "opening_hours": "^3.6.0",
 | 
				
			||||||
        "osm-auth": "^2.6.0",
 | 
					        "osm-auth": "^2.6.0",
 | 
				
			||||||
| 
						 | 
					@ -20056,9 +20055,9 @@
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/name-suggestion-index": {
 | 
					    "node_modules/name-suggestion-index": {
 | 
				
			||||||
      "version": "6.0.20250302",
 | 
					      "version": "6.0.20250413",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250302.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250413.tgz",
 | 
				
			||||||
      "integrity": "sha512-9tdHRaHBXhFTXCt0FGWhOuIRWx8GalsbTD2GIL9B8XmFah8q6hk99yjMMnRkRAedarvJpYHaUCSbkaH6QQpplA==",
 | 
					      "integrity": "sha512-rJ+6A2pp/NQ9gidWs72XuVBlfzynF4IaoeOFhKX19fCQbVNHiWbxlTSxQ852pQoisJXDSW5kgzakoKz7uxo9BA==",
 | 
				
			||||||
      "license": "BSD-3-Clause",
 | 
					      "license": "BSD-3-Clause",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "diacritics": "^1.3.0",
 | 
					        "diacritics": "^1.3.0",
 | 
				
			||||||
| 
						 | 
					@ -44340,9 +44339,9 @@
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "name-suggestion-index": {
 | 
					    "name-suggestion-index": {
 | 
				
			||||||
      "version": "6.0.20250302",
 | 
					      "version": "6.0.20250413",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250302.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/name-suggestion-index/-/name-suggestion-index-6.0.20250413.tgz",
 | 
				
			||||||
      "integrity": "sha512-9tdHRaHBXhFTXCt0FGWhOuIRWx8GalsbTD2GIL9B8XmFah8q6hk99yjMMnRkRAedarvJpYHaUCSbkaH6QQpplA==",
 | 
					      "integrity": "sha512-rJ+6A2pp/NQ9gidWs72XuVBlfzynF4IaoeOFhKX19fCQbVNHiWbxlTSxQ852pQoisJXDSW5kgzakoKz7uxo9BA==",
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "diacritics": "^1.3.0",
 | 
					        "diacritics": "^1.3.0",
 | 
				
			||||||
        "run-s": "^0.0.0",
 | 
					        "run-s": "^0.0.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,8 @@
 | 
				
			||||||
    "summary_server": "https://cache.mapcomplete.org/",
 | 
					    "summary_server": "https://cache.mapcomplete.org/",
 | 
				
			||||||
    "geoip_server": "https://ipinfo.mapcomplete.org/",
 | 
					    "geoip_server": "https://ipinfo.mapcomplete.org/",
 | 
				
			||||||
    "error_server": "https://report.mapcomplete.org/report",
 | 
					    "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": {
 | 
					    "api_keys": {
 | 
				
			||||||
      "#": "Various API-keys for various services. Feel free to reuse those in another MapComplete-hosted version",
 | 
					      "#": "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",
 | 
					      "#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": "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 -",
 | 
					    "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: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",
 | 
					    "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/",
 | 
					    "scrapeWebsites": "vite-node scripts/importscripts/compareWebsiteData.ts -- ~/Downloads/ShopsWithWebsiteNodes.csv ~/data/scraped_websites/",
 | 
				
			||||||
    "### 0": "VELOPARK",
 | 
					    "### 0": "VELOPARK",
 | 
				
			||||||
| 
						 | 
					@ -229,7 +231,7 @@
 | 
				
			||||||
    "marked": "^12.0.2",
 | 
					    "marked": "^12.0.2",
 | 
				
			||||||
    "monaco-editor": "^0.46.0",
 | 
					    "monaco-editor": "^0.46.0",
 | 
				
			||||||
    "mvt-to-geojson": "^0.0.6",
 | 
					    "mvt-to-geojson": "^0.0.6",
 | 
				
			||||||
    "name-suggestion-index": "^6.0.20250302",
 | 
					    "name-suggestion-index": "^6.0.20250413",
 | 
				
			||||||
    "npm": "^11.1.0",
 | 
					    "npm": "^11.1.0",
 | 
				
			||||||
    "opening_hours": "^3.6.0",
 | 
					    "opening_hours": "^3.6.0",
 | 
				
			||||||
    "osm-auth": "^2.6.0",
 | 
					    "osm-auth": "^2.6.0",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -126,7 +126,7 @@ class DownloadEli extends Script {
 | 
				
			||||||
        fs.writeFileSync(targetGlobal, JSON.stringify(contentsGlobal, null, "  "), {
 | 
					        fs.writeFileSync(targetGlobal, JSON.stringify(contentsGlobal, null, "  "), {
 | 
				
			||||||
            encoding: "utf8",
 | 
					            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 = {
 | 
					        const config: LayerConfigJson = {
 | 
				
			||||||
            id: "nsi_" + type,
 | 
					            id: "nsi_" + type,
 | 
				
			||||||
            description: {
 | 
					            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",
 | 
					            source: "special:library",
 | 
				
			||||||
            pointRendering: null,
 | 
					            pointRendering: null,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,7 +8,18 @@ then
 | 
				
			||||||
  npm run generate:layeroverview
 | 
					  npm run generate:layeroverview
 | 
				
			||||||
  npm run generate:layouts
 | 
					  npm run generate:layouts
 | 
				
			||||||
fi
 | 
					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
 | 
					npm run build
 | 
				
			||||||
echo '''
 | 
					echo '''
 | 
				
			||||||
import type { CapacitorConfig } from "@capacitor/cli";
 | 
					import type { CapacitorConfig } from "@capacitor/cli";
 | 
				
			||||||
| 
						 | 
					@ -22,6 +33,7 @@ const config: CapacitorConfig = {
 | 
				
			||||||
export default config;
 | 
					export default config;
 | 
				
			||||||
''' > capacitor.config.ts
 | 
					''' > capacitor.config.ts
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# copy distribution files
 | 
					# copy distribution files
 | 
				
			||||||
rm -rf dist-full
 | 
					rm -rf dist-full
 | 
				
			||||||
mkdir 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/templates dist-full/assets/
 | 
				
			||||||
cp -r dist/assets/generated/themes/ dist-full/assets/generated/
 | 
					cp -r dist/assets/generated/themes/ dist-full/assets/generated/
 | 
				
			||||||
cp -r dist/assets/themes dist-full/assets/
 | 
					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
 | 
					# mkdir dist-full/assets/generated
 | 
				
			||||||
nvm use
 | 
					nvm use
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +76,8 @@ nvm use
 | 
				
			||||||
npx capacitor-assets generate
 | 
					npx capacitor-assets generate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
npx cap sync
 | 
					npx cap sync
 | 
				
			||||||
cd android
 | 
					npm run clean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
echo "All done! Don't forget to click 'gradle sync files' in Android Studio"
 | 
					echo "All done! Don't forget to click 'gradle sync files' in Android Studio"
 | 
				
			||||||
tput bel
 | 
					tput bel
 | 
				
			||||||
tput bel
 | 
					tput bel
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -8,6 +8,7 @@ import { TypedTranslation } from "../../UI/i18n/Translation"
 | 
				
			||||||
import { RegexTag } from "../Tags/RegexTag"
 | 
					import { RegexTag } from "../Tags/RegexTag"
 | 
				
			||||||
import { TagConfigJson } from "../../Models/ThemeConfig/Json/TagConfigJson"
 | 
					import { TagConfigJson } from "../../Models/ThemeConfig/Json/TagConfigJson"
 | 
				
			||||||
import { TagUtils } from "../Tags/TagUtils"
 | 
					import { TagUtils } from "../Tags/TagUtils"
 | 
				
			||||||
 | 
					import Constants from "../../Models/Constants"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Main name suggestion index file
 | 
					 * Main name suggestion index file
 | 
				
			||||||
| 
						 | 
					@ -69,8 +70,10 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
    private loco: LocationConflation // Some additional boundaries
 | 
					    private loco: LocationConflation // Some additional boundaries
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private _supportedTypes: string[]
 | 
					    private _supportedTypes: string[]
 | 
				
			||||||
 | 
					    private _serverLocation: string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    constructor(
 | 
					    private constructor(
 | 
				
			||||||
 | 
					        serverLocation: string,
 | 
				
			||||||
        nsiFile: Readonly<NSIFile>,
 | 
					        nsiFile: Readonly<NSIFile>,
 | 
				
			||||||
        nsiWdFile: Readonly<
 | 
					        nsiWdFile: Readonly<
 | 
				
			||||||
            Record<
 | 
					            Record<
 | 
				
			||||||
| 
						 | 
					@ -82,6 +85,7 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
        >,
 | 
					        >,
 | 
				
			||||||
        features: Readonly<FeatureCollection>
 | 
					        features: Readonly<FeatureCollection>
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
 | 
					        this._serverLocation = serverLocation
 | 
				
			||||||
        this.nsiFile = nsiFile
 | 
					        this.nsiFile = nsiFile
 | 
				
			||||||
        this.nsiWdFile = nsiWdFile
 | 
					        this.nsiWdFile = nsiWdFile
 | 
				
			||||||
        this.loco = new LocationConflation(features)
 | 
					        this.loco = new LocationConflation(features)
 | 
				
			||||||
| 
						 | 
					@ -101,6 +105,7 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
            ].map((url) => Utils.downloadJsonCached(url, 1000 * 60 * 60 * 24 * 30))
 | 
					            ].map((url) => Utils.downloadJsonCached(url, 1000 * 60 * 60 * 24 * 30))
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        NameSuggestionIndex.inited = new NameSuggestionIndex(
 | 
					        NameSuggestionIndex.inited = new NameSuggestionIndex(
 | 
				
			||||||
 | 
					            Constants.nsiLogosEndpoint,
 | 
				
			||||||
            <any>nsi,
 | 
					            <any>nsi,
 | 
				
			||||||
            <any>nsiWd["wikidata"],
 | 
					            <any>nsiWd["wikidata"],
 | 
				
			||||||
            <any>features
 | 
					            <any>features
 | 
				
			||||||
| 
						 | 
					@ -129,12 +134,13 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
     * @param countries
 | 
					     * @param countries
 | 
				
			||||||
     * @private
 | 
					     * @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(
 | 
					        let stats = await Promise.all(
 | 
				
			||||||
            countries.map((c) => {
 | 
					            countries.map((c) => {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    return Utils.downloadJsonCached<Record<string, number>>(
 | 
					                    return Utils.downloadJsonCached<Record<string, number>>(
 | 
				
			||||||
                        `./assets/data/nsi/stats/${type}.${c.toUpperCase()}.json`,
 | 
					                        `${server}/stats/${type}.${c.toUpperCase()}.json`,
 | 
				
			||||||
                        24 * 60 * 60 * 1000
 | 
					                        24 * 60 * 60 * 1000
 | 
				
			||||||
                    )
 | 
					                    )
 | 
				
			||||||
                } catch (e) {
 | 
					                } catch (e) {
 | 
				
			||||||
| 
						 | 
					@ -194,7 +200,7 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
        const mappings: (Mapping & { frequency: number })[] = []
 | 
					        const mappings: (Mapping & { frequency: number })[] = []
 | 
				
			||||||
        const frequencies =
 | 
					        const frequencies =
 | 
				
			||||||
            country !== undefined
 | 
					            country !== undefined
 | 
				
			||||||
                ? await NameSuggestionIndex.fetchFrequenciesFor(type, country)
 | 
					                ? await this.fetchFrequenciesFor(type, country)
 | 
				
			||||||
                : {}
 | 
					                : {}
 | 
				
			||||||
        for (const key in tags) {
 | 
					        for (const key in tags) {
 | 
				
			||||||
            if (key.startsWith("_")) {
 | 
					            if (key.startsWith("_")) {
 | 
				
			||||||
| 
						 | 
					@ -398,11 +404,12 @@ export default class NameSuggestionIndex {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public getIconUrl(nsiItem: NSIItem): string | undefined {
 | 
					    public getIconUrl(nsiItem: NSIItem): string | undefined {
 | 
				
			||||||
        if (!nsiItem.ext) {
 | 
					        const baseUrl = this._serverLocation
 | 
				
			||||||
 | 
					        if (!nsiItem.ext || baseUrl === null) {
 | 
				
			||||||
            // No extension -> there is no logo
 | 
					            // No extension -> there is no logo
 | 
				
			||||||
            return undefined
 | 
					            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
 | 
					    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 osmAuthConfig: AuthConfig = Constants.config.oauth_credentials
 | 
				
			||||||
    public static nominatimEndpoint: string = Constants.config.nominatimEndpoint
 | 
					    public static nominatimEndpoint: string = Constants.config.nominatimEndpoint
 | 
				
			||||||
    public static photonEndpoint: string = Constants.config.photonEndpoint
 | 
					    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 weblate: string = "https://translate.mapcomplete.org/"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public static linkedDataProxy: string = Constants.config["jsonld-proxy"]
 | 
					    public static linkedDataProxy: string = Constants.config["jsonld-proxy"]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue