remove sign up prompts
This commit is contained in:
parent
77d33c185b
commit
70182d8bb7
10 changed files with 31 additions and 138 deletions
|
|
@ -28,18 +28,13 @@ export function isReady(provider: WeatherProvider): boolean {
|
|||
return provider.envKey === null || Boolean(process.env[provider.envKey]?.trim());
|
||||
}
|
||||
|
||||
/** Provider list for the browser — readiness and limits only, never the keys.
|
||||
* Ready sources lead so the picker starts with working options out of the box. */
|
||||
/** Configured providers available to the browser — never exposes keys or unconfigured sources. */
|
||||
export function listProviders(): ProviderInfo[] {
|
||||
const all = DISPLAY_ORDER.map((id) => {
|
||||
const provider = PROVIDERS[id];
|
||||
return {
|
||||
id,
|
||||
return DISPLAY_ORDER.map((id) => PROVIDERS[id])
|
||||
.filter(isReady)
|
||||
.map((provider) => ({
|
||||
id: provider.id,
|
||||
label: provider.label,
|
||||
ready: isReady(provider),
|
||||
signupUrl: provider.signupUrl,
|
||||
...provider.limits(),
|
||||
};
|
||||
});
|
||||
return [...all.filter((p) => p.ready), ...all.filter((p) => !p.ready)];
|
||||
}));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,6 @@ export const openMeteo: WeatherProvider = {
|
|||
id: "openmeteo",
|
||||
label: "Open-Meteo",
|
||||
envKey: null,
|
||||
signupUrl: "https://open-meteo.com/",
|
||||
limits: () => ({ forecastDays: 14, hourlyStepHours: 1 }),
|
||||
|
||||
async getForecast(lat, lon) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ export const openWeather: WeatherProvider = {
|
|||
id: "openweather",
|
||||
label: "OpenWeather",
|
||||
envKey: "OPENWEATHER_API_KEY",
|
||||
signupUrl: "https://home.openweathermap.org/users/sign_up",
|
||||
limits: () => (usesOneCall() ? { forecastDays: 8, hourlyStepHours: 1 } : { forecastDays: 5, hourlyStepHours: 3 }),
|
||||
|
||||
getForecast(lat, lon) {
|
||||
|
|
|
|||
|
|
@ -74,7 +74,6 @@ export const tomorrowIo: WeatherProvider = {
|
|||
id: "tomorrow",
|
||||
label: "Tomorrow.io",
|
||||
envKey: "TOMORROW_API_KEY",
|
||||
signupUrl: "https://app.tomorrow.io/signup",
|
||||
limits: () => ({ forecastDays: 6, hourlyStepHours: 1 }),
|
||||
|
||||
async getForecast(lat, lon) {
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ export const weatherApi: WeatherProvider = {
|
|||
id: "weatherapi",
|
||||
label: "WeatherAPI",
|
||||
envKey: "WEATHERAPI_API_KEY",
|
||||
signupUrl: "https://www.weatherapi.com/signup.aspx",
|
||||
// Set WEATHERAPI_PLAN=paid in .env.local if your plan includes 14 days.
|
||||
limits: () => ({ forecastDays: process.env.WEATHERAPI_PLAN === "paid" ? 14 : 3, hourlyStepHours: 1 }),
|
||||
|
||||
|
|
|
|||
|
|
@ -121,18 +121,15 @@ export interface WeatherProvider {
|
|||
label: string;
|
||||
/** Name of the env var holding its key, or null if no key is needed. */
|
||||
envKey: string | null;
|
||||
signupUrl: string;
|
||||
/** What this provider can deliver on the plan configured in .env.local. */
|
||||
/** Forecast horizon available on the configured tier. */
|
||||
limits(): { forecastDays: number; hourlyStepHours: 1 | 3 };
|
||||
getForecast(lat: number, lon: number): Promise<ProviderForecast>;
|
||||
}
|
||||
|
||||
/** Safe-to-share provider info for the browser (never includes keys). */
|
||||
/** Configured provider metadata exposed to the browser (never includes keys). */
|
||||
export interface ProviderInfo {
|
||||
id: ProviderId;
|
||||
label: string;
|
||||
ready: boolean;
|
||||
signupUrl: string;
|
||||
forecastDays: number;
|
||||
hourlyStepHours: 1 | 3;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue