14 lines
494 B
TypeScript
14 lines
494 B
TypeScript
import { readRuntimeEnv } from "@/env";
|
|
|
|
export const DEFAULT_MAP_TILE_URL =
|
|
"https://mt0.google.com/vt/lyrs=m&hl=zh-CN&x={x}&y={y}&z={z}";
|
|
|
|
/** Browser-side tile template used only by ordinary-Q&A message-list maps. */
|
|
export function getMapTileUrl(): string {
|
|
return readRuntimeEnv("VITE_MAP_TILE_URL")?.trim() || DEFAULT_MAP_TILE_URL;
|
|
}
|
|
|
|
export function getMapTileAttribution(tileUrl = getMapTileUrl()): string {
|
|
return /(?:^|\.)google\.(?:com|cn)\b/i.test(tileUrl) ? "Google" : "";
|
|
}
|