fix: try redirecting api requests in electron
This PR tries to use protocol.handle to redirect /api and /graphql requests to CLOUD_URL.
However the attempt was blocked:
- when using
file://scheme, it seems we cannot overwrite it withprotocol.handle. see https://github.com/electron/electron/issues/39031 - when using
assets://scheme, the message from render to helper cannot be intercepted.
In either way, the proposal seems to be stuck at the moment. Alternatively and maybe more reasonably, we shall add prefix urls to fetch usage in the renderer, instead of calling /api/xxx instead.
This branch is running in CodeSandbox. Use the links below to review this PR faster.
Open in CodeSandbox Web Editor | VS Code | VS Code Insiders | Preview
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Comments | Updated (UTC) |
|---|---|---|---|---|
| affine-docs | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 10, 2023 4:40pm |
| affine-preview | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 10, 2023 4:40pm |
| affine-storybook | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jul 10, 2023 4:40pm |
Codecov Report
Patch coverage has no change and project coverage change: -1.87 :warning:
Comparison is base (
812e0e9) 67.85% compared to head (69311a9) 65.98%.
Additional details and impacted files
@@ Coverage Diff @@
## master #3136 +/- ##
==========================================
- Coverage 67.85% 65.98% -1.87%
==========================================
Files 347 345 -2
Lines 8293 8267 -26
Branches 1074 1068 -6
==========================================
- Hits 5627 5455 -172
- Misses 2380 2518 +138
- Partials 286 294 +8
| Flag | Coverage Δ | |
|---|---|---|
| e2etest | 57.03% <ø> (+0.06%) |
:arrow_up: |
| e2etest-macos-latest-x64 | ? |
|
| e2etest-ubuntu-latest-x64 | ? |
|
| e2etest-windows-latest-x64 | ? |
|
| server-test | 79.00% <ø> (ø) |
|
| unittest | 56.18% <ø> (+0.03%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Deploying with
Cloudflare Pages
| Latest commit: |
69311a9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://9139bd5f.affine-dev.pages.dev |
| Branch Preview URL: | https://xp-0711-fix-protocol.affine-dev.pages.dev |
affine-toeverything
Bundle main
diff ------------------- Bundle Size Diff -------------------------
@@ EntryPoint: main @@
## master …/fix/protocol +/- ##
===================================================================
> Bundle 5.26 MB 5.25 MB -11.3 kB(-0.21%)
> Initial JS 2.23 MB 2.23 MB -2.64 kB(-0.12%)
= Initial CSS 72.8 kB 72.8 kB
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
= Assets 71 71
= Chunks 57 57
= Packages 207 207
= Duplicates 19 19
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~#
! Deduplicate versions of libraries
! Separate mixed content assets files
! Avoid cache wasting
@@ EntryPoint: pages/_app @@
## master …/fix/protocol +/- ##
===================================================================
> Bundle 5.16 MB 5.14 MB -11.3 kB(-0.22%)
> Initial JS 2.12 MB 2.12 MB -2.64 kB(-0.12%)
= Initial CSS 72.8 kB 72.8 kB
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
= Assets 69 69
= Chunks 55 55
= Packages 207 207
= Duplicates 19 19
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Warnings ~~~~~~~~~~~~~~~~~~~~~~~~~~~#
! Deduplicate versions of libraries
! Separate mixed content assets files
! Avoid cache wasting
@@ EntryPoint: pages/_error @@
## master …/fix/protocol +/- ##
===================================================================
= Bundle 16.6 kB 16.6 kB
= Initial JS 16.6 kB 16.6 kB
= Initial CSS 0 B 0 B
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
= Assets 2 2
= Chunks 2 2
= Packages 5 5
= Duplicates 0 0
...and more
☁️ Nx Cloud Report
CI is running/has finished running commands for commit 69311a9d319bfd29312f15382ea509e9dd3c7713. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
📂 See all runs for this branch
✅ Successfully ran 1 target
Sent with 💌 from NxCloud.
Closed in https://github.com/toeverything/AFFiNE/pull/3178