Since I run the Trilium server instance in my home network, most of the time I can access it directly through local IP instead of making a detour via the internet through a secure Cloudflare Tunnel (OAuth SSO) using the external hostname that I can use for seamless access when out of my known networks and not logged in to a VPN.
As Trinote already has some connection statistics/details in settings, without looking at the code I'd assume it'd be pretty straightforward to add new functionality, settings for the Internal URL, and possibly renaming existing URL to External URL like shown below. App then chooses which URL to use to communicate with the server, based on the SSID the device is connected to (if any) and using External URL by default. Configuring Internal URL would be optional of course and if it isn't configured, then always use the external URL.
Home Assistant Companion App does this exact thing already. It is intuitive and also works great. (Two server configuration screens attached. HA allows multiple SSIDs to be set for the internal URL, but even just one would be really nice.)
P.S. As an added functionality there could maybe even be a separate option toggle to use internal URL also if a VPN is active. Apparently one can use NWPathMonitor to detect it (albeit one commenter said that it could be against Apple's policies). But at least for me this would only be the sprinkles on top of a huge sundae that the ability to use separate URLs itself would be.
Home Assistant Companion App screenshots
Screenshot 1
Home Assistant allows multiple servers configured, here are the settings to my only server called "Home" (Device name is the configured name the Companion App uses for my iOS device, that is used in HA sensors/automations/etc - so that propably isn't relevant for Trinote).
Screenshot 2
Here I've clicked on the Internal URL row on the previous screen. SSIDs are just strings that are then used by the internal logic to string match connected WLAN name. External URL opens the same kind of editing screen, with only the URL section shown (can't remember how the onboarding/adding a server works in this regard).

Since I run the Trilium server instance in my home network, most of the time I can access it directly through local IP instead of making a detour via the internet through a secure Cloudflare Tunnel (OAuth SSO) using the external hostname that I can use for seamless access when out of my known networks and not logged in to a VPN.
As Trinote already has some connection statistics/details in settings, without looking at the code I'd assume it'd be pretty straightforward to add new functionality, settings for the
Internal URL, and possibly renaming existingURLtoExternal URLlike shown below. App then chooses which URL to use to communicate with the server, based on the SSID the device is connected to (if any) and usingExternal URLby default. ConfiguringInternal URLwould be optional of course and if it isn't configured, then always use the external URL.Home Assistant Companion App does this exact thing already. It is intuitive and also works great. (Two server configuration screens attached. HA allows multiple SSIDs to be set for the internal URL, but even just one would be really nice.)
P.S. As an added functionality there could maybe even be a separate option toggle to use internal URL also if a VPN is active. Apparently one can use NWPathMonitor to detect it (albeit one commenter said that it could be against Apple's policies). But at least for me this would only be the sprinkles on top of a huge sundae that the ability to use separate URLs itself would be.
Home Assistant Companion App screenshots
Screenshot 1
Home Assistant allows multiple servers configured, here are the settings to my only server called "Home" (Device name is the configured name the Companion App uses for my iOS device, that is used in HA sensors/automations/etc - so that propably isn't relevant for Trinote).
Screenshot 2
Here I've clicked on the Internal URL row on the previous screen. SSIDs are just strings that are then used by the internal logic to string match connected WLAN name. External URL opens the same kind of editing screen, with only the URL section shown (can't remember how the onboarding/adding a server works in this regard).