Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 27 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@
"@tanstack/eslint-plugin-router": "1.141.0",
"@tanstack/react-form": "1.27.7",
"@tanstack/react-query": "5.90.16",
"@tanstack/react-router": "1.145.7",
"@tanstack/react-router": "1.153.2",
"@tanstack/react-virtual": "3.13.16",
"@tanstack/router-plugin": "1.145.7",
"@tanstack/router-plugin": "1.153.2",
"@turf/bbox": "7.3.1",
"@turf/bbox-polygon": "7.3.1",
"@turf/center": "7.3.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/node_modules/@tanstack/router-core/dist/cjs/utils.cjs b/node_modules/@tanstack/router-core/dist/cjs/utils.cjs
index 346cac9..f364a0e 100644
--- a/node_modules/@tanstack/router-core/dist/cjs/utils.cjs
+++ b/node_modules/@tanstack/router-core/dist/cjs/utils.cjs
@@ -182,7 +182,7 @@ function decodeSegment(segment) {
}
return sanitizePathSegment(decoded);
}
-const SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:"];
+const SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:", "comapeo:"];
function isDangerousProtocol(url) {
if (!url) return false;
try {
diff --git a/node_modules/@tanstack/router-core/dist/esm/utils.js b/node_modules/@tanstack/router-core/dist/esm/utils.js
index 20822c1..c4b9e50 100644
--- a/node_modules/@tanstack/router-core/dist/esm/utils.js
+++ b/node_modules/@tanstack/router-core/dist/esm/utils.js
@@ -180,7 +180,7 @@ function decodeSegment(segment) {
}
return sanitizePathSegment(decoded);
}
-const SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:"];
+const SAFE_URL_PROTOCOLS = ["http:", "https:", "mailto:", "tel:", "comapeo:"];
function isDangerousProtocol(url) {
if (!url) return false;
try {
6 changes: 6 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,9 @@ fixes.
### [Do not watch fallback map patch when setting up SMP server plugin](./@comapeo+core+5.2.1+001+fix-smp-fallback-map-setup.patch)

By default, core sets up a file watcher for the `fallbackMapPath` option that's provided when instantiating `MapeoManager`. This does not work when packaging the app as an ASAR file (via Electron Forge) because watching a file within the ASAR directory is not possible. Instead, we change the setup so that it does not try to watch the file and instead make the assumption that the file always exists on instantiation, which is generally the case in CoMapeo Desktop (for now).

## @tanstack/router-core

### [Define `comapeo:` protocol as safe](./@tanstack+router-core+1.153.2+001+define-custom-protocol-as-safe.patch)

When the router attempts to do a full page reload, it checks the protocol for security purposes. It uses a hardcoded list for known "safe" protocols which results in issues in the app that attempt to navigate to a `comapeo:` URL with `reloadDocument: true` set. This patch updates the hardcoded list to account for our custom protocol so that the router doesn't consider it dangerous. We are responsible for doing safety checks related to accessing resources using this protocol, which is handled in the protocol handler that's implemented in the main process.
42 changes: 22 additions & 20 deletions src/renderer/src/generated/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ export interface FileRoutesByFullPath {
'/onboarding': typeof OnboardingRouteRouteWithChildren
'/welcome': typeof WelcomeRoute
'/app/settings': typeof AppSettingsRouteRouteWithChildren
'/onboarding/project': typeof OnboardingProjectIndexRoute
'/onboarding/project': typeof OnboardingProjectRouteRouteWithChildren
'/onboarding/data-and-privacy': typeof OnboardingDataAndPrivacyRoute
'/onboarding/device-name': typeof OnboardingDeviceNameRoute
'/onboarding/privacy-policy': typeof OnboardingPrivacyPolicyRoute
Expand All @@ -297,26 +297,27 @@ export interface FileRoutesByFullPath {
'/app/settings/language': typeof AppSettingsLanguageRoute
'/app/settings/test-data': typeof AppSettingsTestDataRoute
'/app/settings/': typeof AppSettingsIndexRoute
'/onboarding/project/': typeof OnboardingProjectIndexRoute
'/app/projects/$projectId/invite': typeof AppProjectsProjectIdInviteRouteRouteWithChildren
'/app/projects/$projectId/settings': typeof AppProjectsProjectIdSettingsRouteRouteWithChildren
'/app/projects/$projectId/team': typeof AppProjectsProjectIdTeamRouteRouteWithChildren
'/app/projects/$projectId/download': typeof AppProjectsProjectIdDownloadRoute
'/app/projects/$projectId/': typeof AppProjectsProjectIdIndexRoute
'/onboarding/project/create': typeof OnboardingProjectCreateIndexRoute
'/onboarding/project/join': typeof OnboardingProjectJoinIndexRoute
'/onboarding/project/create/': typeof OnboardingProjectCreateIndexRoute
'/onboarding/project/join/': typeof OnboardingProjectJoinIndexRoute
'/app/projects/$projectId/settings/categories': typeof AppProjectsProjectIdSettingsCategoriesRoute
'/app/projects/$projectId/settings/info': typeof AppProjectsProjectIdSettingsInfoRoute
'/app/projects/$projectId/team/$deviceId': typeof AppProjectsProjectIdTeamDeviceIdRoute
'/onboarding/project/create/$projectId/success': typeof OnboardingProjectCreateProjectIdSuccessRoute
'/onboarding/project/join/$inviteId/success': typeof OnboardingProjectJoinInviteIdSuccessRoute
'/app/projects/$projectId/exchange': typeof AppProjectsProjectIdExchangeIndexRoute
'/app/projects/$projectId/exchange/': typeof AppProjectsProjectIdExchangeIndexRoute
'/app/projects/$projectId/invite/': typeof AppProjectsProjectIdInviteIndexRoute
'/app/projects/$projectId/settings/': typeof AppProjectsProjectIdSettingsIndexRoute
'/app/projects/$projectId/team/': typeof AppProjectsProjectIdTeamIndexRoute
'/app/projects/$projectId/invite/devices/$deviceId': typeof AppProjectsProjectIdInviteDevicesDeviceIdRouteRouteWithChildren
'/app/projects/$projectId/observations/$observationDocId': typeof AppProjectsProjectIdObservationsObservationDocIdIndexRoute
'/app/projects/$projectId/tracks/$trackDocId': typeof AppProjectsProjectIdTracksTrackDocIdIndexRoute
'/app/projects/$projectId/invite/devices': typeof AppProjectsProjectIdInviteDevicesIndexRoute
'/app/projects/$projectId/observations/$observationDocId/': typeof AppProjectsProjectIdObservationsObservationDocIdIndexRoute
'/app/projects/$projectId/tracks/$trackDocId/': typeof AppProjectsProjectIdTracksTrackDocIdIndexRoute
'/app/projects/$projectId/invite/devices/': typeof AppProjectsProjectIdInviteDevicesIndexRoute
'/app/projects/$projectId/invite/devices/$deviceId/role': typeof AppProjectsProjectIdInviteDevicesDeviceIdRoleRoute
'/app/projects/$projectId/invite/devices/$deviceId/send': typeof AppProjectsProjectIdInviteDevicesDeviceIdSendRoute
'/app/projects/$projectId/observations/$observationDocId/attachments/$driveId/$type/$variant/$name': typeof AppProjectsProjectIdObservationsObservationDocIdAttachmentsDriveIdTypeVariantNameRoute
Expand Down Expand Up @@ -419,26 +420,27 @@ export interface FileRouteTypes {
| '/app/settings/language'
| '/app/settings/test-data'
| '/app/settings/'
| '/onboarding/project/'
| '/app/projects/$projectId/invite'
| '/app/projects/$projectId/settings'
| '/app/projects/$projectId/team'
| '/app/projects/$projectId/download'
| '/app/projects/$projectId/'
| '/onboarding/project/create'
| '/onboarding/project/join'
| '/onboarding/project/create/'
| '/onboarding/project/join/'
| '/app/projects/$projectId/settings/categories'
| '/app/projects/$projectId/settings/info'
| '/app/projects/$projectId/team/$deviceId'
| '/onboarding/project/create/$projectId/success'
| '/onboarding/project/join/$inviteId/success'
| '/app/projects/$projectId/exchange'
| '/app/projects/$projectId/exchange/'
| '/app/projects/$projectId/invite/'
| '/app/projects/$projectId/settings/'
| '/app/projects/$projectId/team/'
| '/app/projects/$projectId/invite/devices/$deviceId'
| '/app/projects/$projectId/observations/$observationDocId'
| '/app/projects/$projectId/tracks/$trackDocId'
| '/app/projects/$projectId/invite/devices'
| '/app/projects/$projectId/observations/$observationDocId/'
| '/app/projects/$projectId/tracks/$trackDocId/'
| '/app/projects/$projectId/invite/devices/'
| '/app/projects/$projectId/invite/devices/$deviceId/role'
| '/app/projects/$projectId/invite/devices/$deviceId/send'
| '/app/projects/$projectId/observations/$observationDocId/attachments/$driveId/$type/$variant/$name'
Expand Down Expand Up @@ -597,7 +599,7 @@ declare module '@tanstack/react-router' {
'/onboarding/project_/': {
id: '/onboarding/project_/'
path: '/project'
fullPath: '/onboarding/project'
fullPath: '/onboarding/project/'
preLoaderRoute: typeof OnboardingProjectIndexRouteImport
parentRoute: typeof OnboardingRouteRoute
}
Expand Down Expand Up @@ -653,14 +655,14 @@ declare module '@tanstack/react-router' {
'/onboarding/project/join/': {
id: '/onboarding/project/join/'
path: '/join'
fullPath: '/onboarding/project/join'
fullPath: '/onboarding/project/join/'
preLoaderRoute: typeof OnboardingProjectJoinIndexRouteImport
parentRoute: typeof OnboardingProjectRouteRoute
}
'/onboarding/project/create/': {
id: '/onboarding/project/create/'
path: '/create'
fullPath: '/onboarding/project/create'
fullPath: '/onboarding/project/create/'
preLoaderRoute: typeof OnboardingProjectCreateIndexRouteImport
parentRoute: typeof OnboardingProjectRouteRoute
}
Expand Down Expand Up @@ -723,7 +725,7 @@ declare module '@tanstack/react-router' {
'/app/projects/$projectId_/exchange/': {
id: '/app/projects/$projectId_/exchange/'
path: '/projects/$projectId/exchange'
fullPath: '/app/projects/$projectId/exchange'
fullPath: '/app/projects/$projectId/exchange/'
preLoaderRoute: typeof AppProjectsProjectIdExchangeIndexRouteImport
parentRoute: typeof AppRouteRoute
}
Expand Down Expand Up @@ -765,21 +767,21 @@ declare module '@tanstack/react-router' {
'/app/projects/$projectId_/invite/devices/': {
id: '/app/projects/$projectId_/invite/devices/'
path: '/devices'
fullPath: '/app/projects/$projectId/invite/devices'
fullPath: '/app/projects/$projectId/invite/devices/'
preLoaderRoute: typeof AppProjectsProjectIdInviteDevicesIndexRouteImport
parentRoute: typeof AppProjectsProjectIdInviteRouteRoute
}
'/app/projects/$projectId/tracks/$trackDocId/': {
id: '/app/projects/$projectId/tracks/$trackDocId/'
path: '/tracks/$trackDocId'
fullPath: '/app/projects/$projectId/tracks/$trackDocId'
fullPath: '/app/projects/$projectId/tracks/$trackDocId/'
preLoaderRoute: typeof AppProjectsProjectIdTracksTrackDocIdIndexRouteImport
parentRoute: typeof AppProjectsProjectIdRouteRoute
}
'/app/projects/$projectId/observations/$observationDocId/': {
id: '/app/projects/$projectId/observations/$observationDocId/'
path: '/observations/$observationDocId'
fullPath: '/app/projects/$projectId/observations/$observationDocId'
fullPath: '/app/projects/$projectId/observations/$observationDocId/'
preLoaderRoute: typeof AppProjectsProjectIdObservationsObservationDocIdIndexRouteImport
parentRoute: typeof AppProjectsProjectIdRouteRoute
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Stack from '@mui/material/Stack'
import Typography from '@mui/material/Typography'
import { captureMessage } from '@sentry/react'
import { useMutation, useSuspenseQuery } from '@tanstack/react-query'
import { createFileRoute, redirect, useRouter } from '@tanstack/react-router'
import { createFileRoute, useRouter } from '@tanstack/react-router'
import { defineMessages, useIntl } from 'react-intl'
import * as v from 'valibot'

Expand Down Expand Up @@ -104,7 +104,7 @@ export const Route = createFileRoute(
)
})
) {
throw redirect({
throw Route.redirect({
to: '/app/projects/$projectId/observations/$observationDocId',
params: { projectId, observationDocId },
})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Outlet, createFileRoute, redirect } from '@tanstack/react-router'
import { Outlet, createFileRoute } from '@tanstack/react-router'

import { GenericRoutePendingComponent } from '../../../../../../../components/generic-route-pending-component'

Expand All @@ -15,7 +15,7 @@ export const Route = createFileRoute(
const matchingPeer = peers.find((p) => p.deviceId === deviceId)

if (!matchingPeer) {
throw redirect({
throw Route.redirect({
to: '/app/projects/$projectId/invite/devices',
params: { projectId },
replace: true,
Expand All @@ -31,7 +31,7 @@ export const Route = createFileRoute(

// TODO: Do not redirect if member left project?
if (member) {
throw redirect({
throw Route.redirect({
to: '/app/projects/$projectId/invite/devices',
params: { projectId },
replace: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import List from '@mui/material/List'
import ListItem from '@mui/material/ListItem'
import Stack from '@mui/material/Stack'
import Typography from '@mui/material/Typography'
import { createFileRoute, redirect, useRouter } from '@tanstack/react-router'
import { createFileRoute, useRouter } from '@tanstack/react-router'
import { defineMessages, useIntl } from 'react-intl'

import { BLUE_GREY, DARK_GREY, DARK_ORANGE } from '../../../../../colors'
Expand All @@ -31,7 +31,7 @@ export const Route = createFileRoute('/app/projects/$projectId_/invite/')({
})

if (members.length > 1) {
throw redirect({
throw Route.redirect({
to: '/app/projects/$projectId/invite/devices',
params: { projectId },
replace: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
import Box from '@mui/material/Box'
import {
Outlet,
createFileRoute,
notFound,
redirect,
} from '@tanstack/react-router'
import { Outlet, createFileRoute, notFound } from '@tanstack/react-router'

import { TwoPanelLayout } from '../../../-components/two-panel-layout'
import { LIGHT_GREY } from '../../../../../colors'
Expand Down Expand Up @@ -52,7 +47,7 @@ export const Route = createFileRoute('/app/projects/$projectId_/invite')({
// TODO: Should be checking the specific role permissions instead
// https://github.com/digidem/comapeo-mobile/issues/1316
if (!isAtLeastCoordinator) {
throw redirect({ to: '/', replace: true })
throw Route.redirect({ to: '/', replace: true })
}

return { projectApi }
Expand Down
Loading