Support deep link for Dyad Pro (#25)

This commit is contained in:
Will Chen
2025-04-26 10:58:11 -07:00
committed by GitHub
parent 4848b2f085
commit eda2f9206d
6 changed files with 174 additions and 30 deletions

32
src/main/pro.ts Normal file
View File

@@ -0,0 +1,32 @@
import { readSettings, writeSettings } from "./settings";
export function handleDyadProReturn({
apiKey,
budgetResetAt,
maxBudget,
}: {
apiKey: string;
budgetResetAt: string | null | undefined;
maxBudget: number | null | undefined;
}) {
const settings = readSettings();
writeSettings({
providerSettings: {
...settings.providerSettings,
auto: {
...settings.providerSettings.auto,
apiKey: {
value: apiKey,
},
},
},
dyadProBudget:
budgetResetAt && maxBudget
? {
budgetResetAt,
maxBudget,
}
: undefined,
enableDyadPro: true,
});
}