Skip to content
This repository has been archived by the owner on Jun 28, 2021. It is now read-only.

add site association for ios universal linking #851

Merged
merged 3 commits into from
Aug 7, 2017
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
23 changes: 23 additions & 0 deletions src/server/config/apple-app-site-association.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"activitycontinuation": {
"apps": [
"MKP73M5X4A.com.quran.ios"
]
},
"webcredentials": {
"apps": [
"MKP73M5X4A.com.quran.ios"
]
},
"applinks": {
"apps": [],
"details": [
{
"appID": "MKP73M5X4A.com.quran.ios",
"paths": [
"*"
]
}
]
}
}
9 changes: 9 additions & 0 deletions src/server/config/express.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import useragent from 'express-useragent';
import cookieParser from 'cookie-parser';
import cors from 'cors';
import httpProxy from 'http-proxy';
import fs from 'fs';

import support from './support';

Expand Down Expand Up @@ -55,6 +56,14 @@ export default (server) => {
proxyOneQuran.web(req, res);
});

server.use('/apple-app-site-association', (req, res) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a static file(same as manifest.json), why we need route for this?

https://quran.com/manifest.json

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we set the content-type from the static folder? the file cannot have an extension of .json

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to say you can use express' static file helper with the route and add content type. Not certain but this works

const siteAssociation = fs.readFileSync(
`${__dirname}/apple-app-site-association.json`
);
res.set('Content-Type', 'application/json');
res.status(200).send(siteAssociation);
});

server.use('/api', (req, res) => {
proxyApi.web(req, res);
});
Expand Down