Skip to content

Commit 05e6803

Browse files
authored
TW-1456: Limit DApps list for iOS (#158)
1 parent 3a5a915 commit 05e6803

File tree

3 files changed

+47
-8
lines changed

3 files changed

+47
-8
lines changed

src/getDAppsStats.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { dappList } from './utils/dapp-list-constants';
1+
import { DAPPS_LIST, IOS_DAPPS_LIST } from './utils/dapp-list-constants';
22
import logger from './utils/logger';
33

4-
const getDAppsStats = async () => {
4+
const getDAppsStats = (forIOs: boolean) => {
55
logger.info('Getting dApps list...');
66

77
return {
8-
dApps: dappList
8+
dApps: forIOs ? IOS_DAPPS_LIST : DAPPS_LIST
99
};
1010
};
1111

src/index.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ app.use(pinoHttp(PINO_LOGGER));
6666
app.use(cors());
6767
app.use(bodyParser.json());
6868

69-
const dAppsProvider = new SingleQueryDataProvider(15 * 60 * 1000, getDAppsStats);
70-
7169
const androidApp = firebaseAdmin.initializeApp(
7270
{
7371
projectId: 'templewallet-fa3b3'
@@ -162,7 +160,13 @@ app.post('/api/notifications', basicAuth, async (req, res) => {
162160
}
163161
});
164162

165-
app.get('/api/dapps', makeProviderDataRequestHandler(dAppsProvider));
163+
app.get('/api/dapps', (req, res) => {
164+
const platform = req.query.platform;
165+
166+
const data = getDAppsStats(platform === 'ios');
167+
168+
res.status(200).header('Cache-Control', 'public, max-age=300').send(data);
169+
});
166170

167171
app.get('/api/abtest', (_, res) => {
168172
const data = getABData();

src/utils/dapp-list-constants.ts

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
interface DappList {
1+
interface DappListItem {
22
name: string;
33
dappUrl: string;
44
type: DappType;
@@ -16,7 +16,7 @@ enum DappType {
1616
Other = 'Other'
1717
}
1818

19-
export const dappList: DappList[] = [
19+
export const DAPPS_LIST: DappListItem[] = [
2020
{
2121
name: 'QuipuSwap',
2222
dappUrl: 'https://quipuswap.com',
@@ -154,3 +154,38 @@ export const dappList: DappList[] = [
154154
categories: [DappType.DeFi]
155155
}
156156
];
157+
158+
export const IOS_DAPPS_LIST: DappListItem[] = [
159+
{
160+
name: 'Tezos Projects',
161+
dappUrl: 'https://ecosystem.tezos.com',
162+
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/tezos.png',
163+
slug: 'ecosystem.tezos.com',
164+
type: DappType.Other,
165+
categories: []
166+
},
167+
{
168+
name: 'Mad.Fish',
169+
dappUrl: 'https://mad.fish/products',
170+
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/madfish.png',
171+
slug: 'mad.fish/products',
172+
type: DappType.Other,
173+
categories: []
174+
},
175+
{
176+
name: 'Temple Wallet',
177+
dappUrl: 'https://templewallet.com/download?platform=extension',
178+
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/temple.png',
179+
slug: 'download-tw-extension',
180+
type: DappType.Other,
181+
categories: []
182+
},
183+
{
184+
name: 'TZKT',
185+
dappUrl: 'https://tzkt.io/dapps',
186+
logo: 'https://temple-wallet-stage-bucket.nyc3.cdn.digitaloceanspaces.com/dapps/tzkt.png',
187+
slug: 'tzkt.io/dapps',
188+
type: DappType.Other,
189+
categories: []
190+
}
191+
];

0 commit comments

Comments
 (0)