mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-16 23:00:51 +00:00
feat: implement assetlinks.json for Android app delegation and enhance Nginx configuration for asset handling
This commit is contained in:
parent
c6e889b2a8
commit
5f396d36a4
3 changed files with 32 additions and 8 deletions
|
|
@ -19,15 +19,15 @@ const Captcha: React.FC<CaptchaProps> = ({
|
|||
className,
|
||||
}: CaptchaProps): JSX.Element => {
|
||||
const captchaRef = React.useRef<HCaptcha | null>(null);
|
||||
const onTokenChangeRef = React.useRef<typeof onTokenChange>(onTokenChange);
|
||||
|
||||
const handleTokenChange = React.useCallback(
|
||||
(token: string | null) => {
|
||||
if (onTokenChange) {
|
||||
onTokenChange(token || "");
|
||||
}
|
||||
},
|
||||
[onTokenChange],
|
||||
);
|
||||
React.useEffect(() => {
|
||||
onTokenChangeRef.current = onTokenChange;
|
||||
}, [onTokenChange]);
|
||||
|
||||
const handleTokenChange = React.useCallback((token: string | null) => {
|
||||
onTokenChangeRef.current?.(token || "");
|
||||
}, []);
|
||||
|
||||
React.useEffect(() => {
|
||||
captchaRef.current?.resetCaptcha();
|
||||
|
|
|
|||
8
Home/Static/.well-known/assetlinks.json
Normal file
8
Home/Static/.well-known/assetlinks.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[{
|
||||
"relation": ["delegate_permission/common.handle_all_urls"],
|
||||
"target": {
|
||||
"namespace": "android_app",
|
||||
"package_name": "com.oneuptime.twa",
|
||||
"sha256_cert_fingerprints": ["54:96:AD:87:CD:1E:61:66:A3:7A:C4:34:89:84:8E:90:2A:64:FA:A9:33:EB:F6:08:1E:09:48:19:D7:A1:79:70"]
|
||||
}
|
||||
}]
|
||||
|
|
@ -380,6 +380,22 @@ ${PROVISION_SSL_CERTIFICATE_KEY_DIRECTIVE}
|
|||
proxy_pass http://app/api/acme-challenge/.well-known;
|
||||
}
|
||||
|
||||
location /.well-known/assetlinks.json {
|
||||
# This is for nginx not to crash when service is not available.
|
||||
resolver 127.0.0.1 valid=30s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
# enable WebSockets (for ws://sockjs not connected error in the accounts source: https://stackoverflow.com/questions/41381444/websocket-connection-failed-error-during-websocket-handshake-unexpected-respon)
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
|
||||
proxy_pass http://home/public/assets/.well-known/assetlinks.json;
|
||||
}
|
||||
|
||||
# PWA manifest and service worker with proper headers for home
|
||||
location ~* ^/(manifest\.json|service-worker\.js)$ {
|
||||
resolver 127.0.0.1 valid=30s;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue