fix(grokbuild): complete proxy and deep-link integrations (#5677)

* fix(grokbuild): complete proxy integration

* fix(deeplink): preview GrokBuild configs safely

* test(app): stabilize provider integration suite

* fix(grokbuild): address review feedback

* fix(grokbuild): resolve remaining review findings

* fix(grokbuild): use native sessions and harden previews
This commit is contained in:
Thefool
2026-07-31 14:56:42 +08:00
committed by GitHub
parent b884595a23
commit c49cf96a16
16 changed files with 566 additions and 111 deletions
+11 -2
View File
@@ -13,6 +13,10 @@ function toStandardBase64Alphabet(value: string): string {
return value.replace(/ /g, "+").replace(/-/g, "+").replace(/_/g, "/");
}
function trimOuterLineBreaks(value: string): string {
return value.replace(/^[\r\n]+|[\r\n]+$/g, "");
}
/**
* Decode Base64 encoded UTF-8 string
*
@@ -27,7 +31,10 @@ function toStandardBase64Alphabet(value: string): string {
*/
export function decodeBase64Utf8(str: string): string {
try {
let cleaned = toStandardBase64Alphabet(str.trim());
// Keep spaces intact until they are restored to `+`. Using `trim()` here
// would discard a URL-decoded `+` at either edge and diverge from the
// backend decoder, which trims only CR/LF characters.
let cleaned = toStandardBase64Alphabet(trimOuterLineBreaks(str));
// Try to decode with standard Base64 first
try {
@@ -48,7 +55,9 @@ export function decodeBase64Utf8(str: string): string {
console.error("Base64 decode error:", e, "Input:", str);
// Last resort fallback using deprecated but sometimes working method
try {
return decodeURIComponent(escape(atob(toStandardBase64Alphabet(str))));
return decodeURIComponent(
escape(atob(toStandardBase64Alphabet(trimOuterLineBreaks(str)))),
);
} catch {
// If all else fails, return original string
return str;