Deprecate pro budget in app since it's not accurate (#210)
This commit is contained in:
@@ -114,14 +114,17 @@ export const UserSettingsSchema = z.object({
|
|||||||
telemetryUserId: z.string().optional(),
|
telemetryUserId: z.string().optional(),
|
||||||
hasRunBefore: z.boolean().optional(),
|
hasRunBefore: z.boolean().optional(),
|
||||||
enableDyadPro: z.boolean().optional(),
|
enableDyadPro: z.boolean().optional(),
|
||||||
dyadProBudget: DyadProBudgetSchema.optional(),
|
|
||||||
experiments: ExperimentsSchema.optional(),
|
experiments: ExperimentsSchema.optional(),
|
||||||
lastShownReleaseNotesVersion: z.string().optional(),
|
lastShownReleaseNotesVersion: z.string().optional(),
|
||||||
maxChatTurnsInContext: z.number().optional(),
|
maxChatTurnsInContext: z.number().optional(),
|
||||||
enableProSaverMode: z.boolean().optional(),
|
enableProSaverMode: z.boolean().optional(),
|
||||||
enableProLazyEditsMode: z.boolean().optional(),
|
enableProLazyEditsMode: z.boolean().optional(),
|
||||||
enableProSmartFilesContextMode: z.boolean().optional(),
|
enableProSmartFilesContextMode: z.boolean().optional(),
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
// DEPRECATED.
|
// DEPRECATED.
|
||||||
|
////////////////////////////////
|
||||||
|
dyadProBudget: DyadProBudgetSchema.optional(),
|
||||||
runtimeMode: RuntimeModeSchema.optional(),
|
runtimeMode: RuntimeModeSchema.optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
11
src/main.ts
11
src/main.ts
@@ -189,21 +189,12 @@ function handleDeepLinkReturn(url: string) {
|
|||||||
// dyad://dyad-pro-return?key=123&budget_reset_at=2025-05-26T16:31:13.492000Z&max_budget=100
|
// dyad://dyad-pro-return?key=123&budget_reset_at=2025-05-26T16:31:13.492000Z&max_budget=100
|
||||||
if (parsed.hostname === "dyad-pro-return") {
|
if (parsed.hostname === "dyad-pro-return") {
|
||||||
const apiKey = parsed.searchParams.get("key");
|
const apiKey = parsed.searchParams.get("key");
|
||||||
// UTC time
|
|
||||||
// budget_reset_at: '2025-05-26T16:31:13.492000Z'
|
|
||||||
const budgetResetAt = parsed.searchParams.get("budget_reset_at");
|
|
||||||
const maxBudget = Number(parsed.searchParams.get("max_budget"));
|
|
||||||
if (!apiKey) {
|
if (!apiKey) {
|
||||||
dialog.showErrorBox(
|
dialog.showErrorBox("Invalid URL", "Expected key");
|
||||||
"Invalid URL",
|
|
||||||
"Expected key, budget_reset_at, and max_budget",
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
handleDyadProReturn({
|
handleDyadProReturn({
|
||||||
apiKey,
|
apiKey,
|
||||||
budgetResetAt,
|
|
||||||
maxBudget,
|
|
||||||
});
|
});
|
||||||
// Send message to renderer to trigger re-render
|
// Send message to renderer to trigger re-render
|
||||||
mainWindow?.webContents.send("deep-link-received", {
|
mainWindow?.webContents.send("deep-link-received", {
|
||||||
|
|||||||
@@ -1,14 +1,6 @@
|
|||||||
import { readSettings, writeSettings } from "./settings";
|
import { readSettings, writeSettings } from "./settings";
|
||||||
|
|
||||||
export function handleDyadProReturn({
|
export function handleDyadProReturn({ apiKey }: { apiKey: string }) {
|
||||||
apiKey,
|
|
||||||
budgetResetAt,
|
|
||||||
maxBudget,
|
|
||||||
}: {
|
|
||||||
apiKey: string;
|
|
||||||
budgetResetAt: string | null | undefined;
|
|
||||||
maxBudget: number | null | undefined;
|
|
||||||
}) {
|
|
||||||
const settings = readSettings();
|
const settings = readSettings();
|
||||||
writeSettings({
|
writeSettings({
|
||||||
providerSettings: {
|
providerSettings: {
|
||||||
@@ -20,13 +12,6 @@ export function handleDyadProReturn({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dyadProBudget:
|
|
||||||
budgetResetAt && maxBudget
|
|
||||||
? {
|
|
||||||
budgetResetAt,
|
|
||||||
maxBudget,
|
|
||||||
}
|
|
||||||
: undefined,
|
|
||||||
enableDyadPro: true,
|
enableDyadPro: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user