forked from kevin/meshtastic_mqtt_server
新增图源修改功能
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { getDefaultMapSource } from './api'
|
||||
import type { PublicMapTileSource } from './types'
|
||||
|
||||
export const fallbackMapSource: PublicMapTileSource = {
|
||||
id: 0,
|
||||
name: 'OpenStreetMap Japan',
|
||||
url_template: 'https://tile.openstreetmap.jp/{z}/{x}/{y}.png',
|
||||
attribution: '© OpenStreetMap contributors',
|
||||
max_zoom: 19,
|
||||
}
|
||||
|
||||
export async function loadDefaultMapSource(): Promise<PublicMapTileSource> {
|
||||
try {
|
||||
const response = await getDefaultMapSource()
|
||||
return response.item
|
||||
} catch {
|
||||
return fallbackMapSource
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user