forked from MapComplete/MapComplete
Merge master
This commit is contained in:
commit
470e9acc64
66 changed files with 10798 additions and 414 deletions
|
@ -8,7 +8,7 @@ import {Utils} from "../../Utils";
|
|||
export class QueryParameters {
|
||||
|
||||
static defaults = {}
|
||||
static documentation = {}
|
||||
static documentation: Map<string, string> = new Map<string, string>()
|
||||
private static order: string [] = ["layout", "test", "z", "lat", "lon"];
|
||||
private static _wasInitialized: Set<string> = new Set()
|
||||
private static knownSources = {};
|
||||
|
@ -18,7 +18,7 @@ export class QueryParameters {
|
|||
if (!this.initialized) {
|
||||
this.init();
|
||||
}
|
||||
QueryParameters.documentation[key] = documentation;
|
||||
QueryParameters.documentation.set(key, documentation);
|
||||
if (deflt !== undefined) {
|
||||
QueryParameters.defaults[key] = deflt;
|
||||
}
|
||||
|
|
|
@ -121,13 +121,14 @@ export default class Wikipedia {
|
|||
* @param searchTerm
|
||||
*/
|
||||
public async searchViaIndex(searchTerm: string): Promise<{ title: string, snippet: string, url: string } []> {
|
||||
const url = `${this.backend}/w/index.php?search=${encodeURIComponent(searchTerm)}`
|
||||
const url = `${this.backend}/w/index.php?search=${encodeURIComponent(searchTerm)}&ns0=1`
|
||||
const result = await Utils.downloadAdvanced(url);
|
||||
if(result["redirect"] ){
|
||||
const targetUrl = result["redirect"]
|
||||
// This is an exact match
|
||||
return [{
|
||||
title: this.extractPageName(result["redirect"]).trim(),
|
||||
url: result["redirect"],
|
||||
title: this.extractPageName(targetUrl)?.trim(),
|
||||
url: targetUrl,
|
||||
snippet: ""
|
||||
}]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue