Repository navigation
restore-file - Add support for binaries on Firefox - #10129
Conversation
| if (responseFormat === 'base64') { | ||
| const arrayBuffer = await response.arrayBuffer(); | ||
| const content = uint8ArrayToBase64(new Uint8Array(arrayBuffer)); | ||
| const buffer = await response.arrayBuffer(); |
There was a problem hiding this comment.
| const buffer = await response.arrayBuffer(); | |
| const buffer = await response.bytes(); |
?
There was a problem hiding this comment.
Will try. I think the issue here is using the wrong Uint8Array constructor anyway, maybe the issue would be using new window.Uint8Array instead of whatever GPT suggested here. I haven't tested the PR yet.
Not sure if Response.bytes is affected by the same behavior but I have a feeling it is
There was a problem hiding this comment.
I went with .bytes() and the native .toBase64(). Tested in both Safari 27, Firefox 157, and Chrome 153
Safari 18.2 is the new minimum, do you need to change anything Xcode-side?
| }, | ||
| "gecko_android": { | ||
| "strict_min_version": "128.0" | ||
| "strict_min_version": "133.0" |
There was a problem hiding this comment.
- Chrome: 12 months ago
- Firefox 22 months ago
- Safari: 20 months ago (v18.2)
APIs
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add compatible fallbacks or capability gates for the native APIs used on supported Safari versions.
Review effort: Lite
Findings: 2
Open (2)
What changed in this PR
Adds native binary/Base64 handling to fix restore-file on Firefox.
Changes:
- Replaces
uint8array-extraswith native Web APIs. - Updates browser minimums and TypeScript typings.
- Removes the direct encoding dependency.
| File | Summary |
|---|---|
tsconfig.json |
Enables ESNext API typings. |
source/manifest.json |
Raises browser minimum versions. |
source/github-helpers/api.tsx |
Uses native binary response and Base64 APIs. |
source/features/last-notification-page-button.tsx |
Uses native cursor encoding. |
package.json |
Removes the direct dependency. |
package-lock.json |
Updates dependency metadata. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| const lastCursor = Math.floor((totalNotificationsNumber - 1) / itemsPerNotificationsPage) * itemsPerNotificationsPage; | ||
| const nextButtonSearch = new URLSearchParams(nextButton.search); | ||
| nextButtonSearch.set('after', stringToBase64(`cursor:${lastCursor}`)); | ||
| nextButtonSearch.set('after', encoder.encode(`cursor:${lastCursor}`).toBase64()); |
| "tiny-version-compare": "^4.0.0", | ||
| "ts-extras": "^1.3.0", | ||
| "twas": "^2.1.3", | ||
| "uint8array-extras": "^1.5.0", |
There was a problem hiding this comment.
It was always meant to be made obsolete 👍
| "manifest_version": 3, | ||
| "minimum_chrome_version": "123", | ||
| "minimum_chrome_version": "140", | ||
| "browser_specific_settings": { |
There was a problem hiding this comment.
Set minimum version for safari too: https://developer.apple.com/documentation/safariservices/optimizing-your-web-extension-for-safari#Ensure-feature-compatibility-by-specifying-versions
We also need to bump the macOS/iOS version to iOS 18.2 and macOS 15 then, but if you don't have Xcode, I can do it later.
🙏 |

restore-filebroken for binaries on Firefox #10070uint8ArrayToBase64but for ArrayBuffer sindresorhus/uint8array-extras#23Test URLs
https://github.com/refined-github/sandbox/pull/128/changes
Demo
It worked: refined-github/sandbox@
b3b41a3(#128)