-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #352 from thematters/develop
Release: v1.10.0
- Loading branch information
Showing
45 changed files
with
2,363 additions
and
16,719 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
ENV=development | ||
SITE_DOMAIN=http://localhost:3000 | ||
ASSET_DOMAIN=https://assets-develop.matters.news | ||
API_URL=http://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/ | ||
API_URL=http://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/graphql | ||
WS_URL=ws://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/graphql | ||
OAUTH_URL=http://matters-server-develop.ap-southeast-1.elasticbeanstalk.com/oauth | ||
SEGMENT_KEY=3gE20MjzN9qncFqlKV0pDvNO7Cp2gWU3 | ||
FB_APP_ID=823885921293850 | ||
SENTRY_DSN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module.exports = { | ||
client: { | ||
name: 'Matters Web', | ||
service: { | ||
name: 'matters', | ||
url: 'https://server-develop.matters.news/graphql' | ||
}, | ||
includes: [ | ||
'+(pages|views|components)/**/*.{ts,tsx}', | ||
'./common/utils/types/**/*.ts' | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default (_: any) => { | ||
return { | ||
id: 'local', | ||
feedSortType: 'hottest', | ||
__typename: 'ClientPreference' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default (_: any, { input: { id } }: { input: { id: string } }) => { | ||
return { | ||
id, | ||
content: '', | ||
__typename: 'CommentDraft' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import fetch from 'isomorphic-unfetch' | ||
|
||
const TEST_HASH = 'Qmaisz6NMhDB51cCvNWa1GMS7LU1pAxdF4Ld6Ft9kZEP2a' | ||
const PUBLIC_GATEWAYS: string[] = [ | ||
'https://d26g9c7mfuzstv.cloudfront.net/ipfs/', | ||
'https://ipfs.io/ipfs/', | ||
'https://gateway.ipfs.io/ipfs/', | ||
'https://ipfs.infura.io/ipfs/', | ||
'https://ipfs.jes.xxx/ipfs/', | ||
'https://siderus.io/ipfs/', | ||
'https://ipfs.eternum.io/ipfs/', | ||
'https://hardbin.com/ipfs/', | ||
'https://ipfs.wa.hle.rs/ipfs/', | ||
'https://cloudflare-ipfs.com/ipfs/', | ||
'https://gateway.pinata.cloud/ipfs/', | ||
'https://ipfs.sloppyta.co/ipfs/', | ||
'https://ipfs.busy.org/ipfs/', | ||
'https://ipfs.greyh.at/ipfs/', | ||
'https://gateway.serph.network/ipfs/' | ||
] | ||
|
||
function timeout(ms: number, promise: any) { | ||
return new Promise((resolve, reject) => { | ||
setTimeout(() => { | ||
reject(new Error('timeout')) | ||
}, ms) | ||
promise.then(resolve, reject) | ||
}) | ||
} | ||
|
||
// check accessbility for a given hash and gateway | ||
const checkGateway = async ( | ||
hash: string, | ||
gatewayUrl: string | ||
): Promise<boolean> => { | ||
const testUrl = `${gatewayUrl}${hash}#x-ipfs-companion-no-redirect` | ||
|
||
try { | ||
// const res = await fetch(testUrl) | ||
const res = (await timeout( | ||
2000, | ||
fetch(testUrl) | ||
)) as fetch.IsomorphicResponse | ||
if (res && res.ok) { | ||
return true | ||
} | ||
return false | ||
} catch (err) { | ||
console.log(`Gateway not alive, skipping: ${gatewayUrl}`) | ||
return false | ||
} | ||
} | ||
|
||
export default async () => { | ||
const checkers = await Promise.all( | ||
PUBLIC_GATEWAYS.map(url => | ||
checkGateway(TEST_HASH, url).then((alive: boolean) => ({ url, alive })) | ||
) | ||
) | ||
return checkers.filter(({ alive }) => alive).map(({ url }) => url) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import clientPreference from './clientPreference' | ||
import commentDraft from './commentDraft' | ||
import gatewayUrls from './gatewayUrls' | ||
|
||
export default { | ||
Query: { | ||
clientPreference, | ||
commentDraft | ||
}, | ||
Official: { | ||
gatewayUrls | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import gql from 'graphql-tag' | ||
|
||
export default gql` | ||
extend type Query { | ||
commentDraft(input: CommentDraftInput!): CommentDraft! | ||
clientPreference(input: ClientPreferenceInput!): ClientPreference! | ||
} | ||
extend type Official { | ||
gatewayUrls: [URL!] | ||
} | ||
type CommentDraft { | ||
id: ID! | ||
content: String! | ||
} | ||
input CommentDraftInput { | ||
id: ID! | ||
} | ||
type ClientPreference { | ||
id: ID! | ||
feedSortType: FeedSortType | ||
} | ||
input ClientPreferenceInput { | ||
id: ID! | ||
} | ||
enum FeedSortType { | ||
hottest | ||
newest | ||
} | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.