Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: support monograph server url

Ammar Ahmed4014f2a5b5f8
diff --git a/apps/mobile/app/screens/settings/server-config.tsx b/apps/mobile/app/screens/settings/server-config.tsx
index 231b79018..8967743b9 100644
--- a/apps/mobile/app/screens/settings/server-config.tsx
+++ b/apps/mobile/app/screens/settings/server-config.tsx
@@ -32,7 +32,12 @@ import SettingsService from "../../services/settings";
import { HostId, HostIds } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store";
-export const ServerIds = ["notesnook-sync", "auth", "sse"] as const;
+export const ServerIds = [
+ "notesnook-sync",
+ "auth",
+ "sse",
+ "monograph"
+] as const;
export type ServerId = (typeof ServerIds)[number];
type Server = {
id: ServerId;
@@ -40,6 +45,7 @@ type Server = {
title: string;
example: string;
description: string;
+ versionEndpoint: string;
};
type VersionResponse = {
version: number;
@@ -52,21 +58,32 @@ const SERVERS: Server[] = [
host: "API_HOST",
title: strings.syncServer(),
example: "http://localhost:4326",
- description: strings.syncServerDesc()
+ description: strings.syncServerDesc(),
+ versionEndpoint: "/version"
},
{
id: "auth",
host: "AUTH_HOST",
title: strings.authServer(),
example: "http://localhost:5326",
- description: strings.authServerDesc()
+ description: strings.authServerDesc(),
+ versionEndpoint: "/version"
},
{
id: "sse",
host: "SSE_HOST",
title: strings.sseServer(),
example: "http://localhost:7326",
- description: strings.sseServerDesc()
+ description: strings.sseServerDesc(),
+ versionEndpoint: "/version"
+ },
+ {
+ id: "monograph",
+ host: "MONOGRAPH_HOST",
+ title: strings.monographServer(),
+ example: "http://localhost:6326",
+ description: strings.monographServerDesc(),
+ versionEndpoint: "/api/version"
}
];
export function ServersConfiguration() {
@@ -135,12 +152,14 @@ export function ServersConfiguration() {
type="secondary"
width="100%"
onPress={async () => {
+ setError(undefined);
try {
for (const host of HostIds) {
const url = urls[host];
const server = SERVERS.find((s) => s.host === host)!;
+ if (!server) throw new Error(strings.serverNotFound(host));
if (!url) throw new Error(strings.allServerUrlsRequired());
- const version = await fetch(`${url}/version`)
+ const version = await fetch(`${url}${server.versionEndpoint}`)
.then((r) => r.json() as Promise<VersionResponse>)
.catch(() => undefined);
if (!version)
@@ -158,7 +177,6 @@ export function ServersConfiguration() {
}
}
setSuccess(true);
- setError(undefined);
} catch (e) {
setError((e as Error).message);
}
diff --git a/apps/mobile/app/stores/use-setting-store.ts b/apps/mobile/app/stores/use-setting-store.ts
index 665f85560..aa45ceda4 100644
--- a/apps/mobile/app/stores/use-setting-store.ts
+++ b/apps/mobile/app/stores/use-setting-store.ts
@@ -25,7 +25,12 @@ import { FileType } from "react-native-scoped-storage";
import create, { State } from "zustand";
import { ThemeDark, ThemeLight, ThemeDefinition } from "@notesnook/theme";
import { Reminder } from "@notesnook/core";
-export const HostIds = ["API_HOST", "AUTH_HOST", "SSE_HOST"] as const;
+export const HostIds = [
+ "API_HOST",
+ "AUTH_HOST",
+ "SSE_HOST",
+ "MONOGRAPH_HOST"
+] as const;
export type HostId = (typeof HostIds)[number];
export type Settings = {
diff --git a/apps/mobile/native/android/build.gradle b/apps/mobile/native/android/build.gradle
index e4e4245c1..f4b8557d9 100644
--- a/apps/mobile/native/android/build.gradle
+++ b/apps/mobile/native/android/build.gradle
@@ -12,7 +12,7 @@ buildscript {
androidXCoreVersion = "1.7.0"
androidXCore = "1.7.0"
androidXBrowser = "1.0.0"
- ndkVersion = "23.1.7779620"
+ ndkVersion = "23.2.8568313"
}
repositories {