diff --git a/keyserver/src/responders/deep-link-responder.js b/keyserver/src/responders/deep-link-responder.js --- a/keyserver/src/responders/deep-link-responder.js +++ b/keyserver/src/responders/deep-link-responder.js @@ -1,5 +1,6 @@ // @flow +import { html } from 'common-tags'; import { detect as detectBrowser } from 'detect-browser'; import type { $Response, $Request } from 'express'; @@ -7,22 +8,105 @@ const inviteSecretRegex = /^[a-z0-9]+$/i; -function deepLinkResponder(req: $Request, res: $Response) { +async function deepLinkResponder(req: $Request, res: $Response) { const { secret } = req.params; const userAgent = req.get('User-Agent'); const detectionResult = detectBrowser(userAgent); - let redirectUrl = stores.appStoreUrl; if (detectionResult.os === 'Android OS') { const isSecretValid = inviteSecretRegex.test(secret); const referrer = isSecretValid ? `&referrer=${encodeURIComponent(`utm_source=invite/${secret}`)}` : ''; - redirectUrl = `${stores.googlePlayUrl}${referrer}`; + const redirectUrl = `${stores.googlePlayUrl}${referrer}`; + res.writeHead(301, { + Location: redirectUrl, + }); + res.end(); + } else { + res.end(html` + + + + Comm + + + +
+

Comm

+

+ To join this community, download the Comm app and reopen this + invite link +

+
+
Community Details
+
+ Download Comm + Invite Link +
+ + + `); } - res.writeHead(301, { - Location: redirectUrl, - }); - res.end(); } export { deepLinkResponder };