forked from Mirrors/doipjs
Update definitions
This commit is contained in:
parent
a9e69de547
commit
f4308fb79d
17 changed files with 204 additions and 211 deletions
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://dev.to/api/articles/${match[1]}/${match[2]}`,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://dev.to/api/articles/${match[1]}/${match[2]}`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['body_markdown'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)\/u\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://${match[1]}/u/${match[2]}.json`,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://${match[1]}/u/${match[2]}.json`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['user', 'bio_raw'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,38 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const dns = require('dns')
|
||||
const bent = require('bent')
|
||||
const req = bent('GET')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
||||
|
||||
const customRequestHandler = async (spData, opts) => {
|
||||
if ('resolveTxt' in dns) {
|
||||
const prom = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
dns.resolveTxt(spData.profile.display, (err, records) => {
|
||||
if (err) reject(err)
|
||||
resolve(records)
|
||||
})
|
||||
})
|
||||
}
|
||||
return {
|
||||
hostname: spData.profile.display,
|
||||
records: {
|
||||
txt: await prom(),
|
||||
},
|
||||
}
|
||||
} else {
|
||||
const res = await req(spData.proof.uri, null, {
|
||||
Accept: 'application/json',
|
||||
})
|
||||
const json = await res.json()
|
||||
return json
|
||||
}
|
||||
}
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
if (!opts) {
|
||||
opts = {}
|
||||
|
@ -63,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: null,
|
||||
fetch: null,
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.DNS,
|
||||
access: E.ProofAccess.SERVER,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
domain: match[1],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.URI,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['records', 'txt'],
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)\/users\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: uri,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.FINGERPRINT,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['summary'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.EQUALS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.EQUALS,
|
||||
path: ['description'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://api.github.com/gists/${match[2]}`,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://api.github.com/gists/${match[2]}`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['files', 'openpgp.md', 'content'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,52 +13,10 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const bent = require('bent')
|
||||
const req = bent('GET')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)\/(.*)\/gitlab_proof\/?/
|
||||
|
||||
const customRequestHandler = async (spData, opts) => {
|
||||
const match = spData.proof.uri.match(reURI)
|
||||
|
||||
const urlUser = `https://${match[1]}/api/v4/users?username=${match[2]}`
|
||||
let resUser
|
||||
try {
|
||||
resUser = await req(urlUser, null, { Accept: 'application/json' })
|
||||
} catch (e) {
|
||||
resUser = await req(utils.generateProxyURL('web', urlUser, opts), null, {
|
||||
Accept: 'application/json',
|
||||
})
|
||||
}
|
||||
const jsonUser = await resUser.json()
|
||||
|
||||
const user = jsonUser.find((user) => user.username === match[2])
|
||||
if (!user) {
|
||||
throw new Error(`No user with username ${match[2]}`)
|
||||
}
|
||||
|
||||
const urlProject = `https://${match[1]}/api/v4/users/${user.id}/projects`
|
||||
let resProject
|
||||
try {
|
||||
resProject = await req(urlProject, null, { Accept: 'application/json' })
|
||||
} catch (e) {
|
||||
resProject = await req(
|
||||
utils.generateProxyURL('web', urlProject, opts),
|
||||
null,
|
||||
{ Accept: 'application/json' }
|
||||
)
|
||||
}
|
||||
const jsonProject = await resProject.json()
|
||||
|
||||
const project = jsonProject.find((proj) => proj.path === 'gitlab_proof')
|
||||
if (!project) {
|
||||
throw new Error(`No project at ${spData.proof.uri}`)
|
||||
}
|
||||
|
||||
return project
|
||||
}
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
if (!opts) {
|
||||
opts = {}
|
||||
|
@ -77,17 +35,22 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.GITLAB,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
domain: match[1],
|
||||
username: match[2],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.EQUALS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.EQUALS,
|
||||
path: ['description'],
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`,
|
||||
fetch: null,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.URI,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['about'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const utils = require('../utils')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/
|
||||
|
||||
|
@ -35,18 +34,23 @@ const processURI = (uri, opts) => {
|
|||
qr: null,
|
||||
},
|
||||
proof: {
|
||||
uri: utils.generateProxyURL('irc', [match[1], match[2]], opts),
|
||||
fetch: null,
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
uri: null,
|
||||
request: {
|
||||
fetcher: E.Fetcher.IRC,
|
||||
access: E.ProofAccess.SERVER,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
domain: match[1],
|
||||
nick: match[2],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.URI,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: [],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/liberapay\.com\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://liberapay.com/${match[1]}/public.json`,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://liberapay.com/${match[1]}/public.json`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['statements', 'content'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: `https://lobste.rs/u/${match[1]}.json`,
|
||||
fetch: null,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://lobste.rs/u/${match[1]}.json`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['about'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)\/@(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: uri,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.FINGERPRINT,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['attachment', 'value'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,11 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const bent = require('bent')
|
||||
const req = bent('GET')
|
||||
const E = require('../enums')
|
||||
const queryString = require('query-string')
|
||||
const utils = require('../utils')
|
||||
|
||||
const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/
|
||||
|
||||
|
@ -27,23 +24,19 @@ const processURI = (uri, opts) => {
|
|||
}
|
||||
const match = uri.match(reURI)
|
||||
|
||||
let profileUrl = null,
|
||||
eventUrl = null,
|
||||
proofUrl = null
|
||||
|
||||
if (match[2]) {
|
||||
const params = queryString.parse(match[2])
|
||||
if ('org.keyoxide.e' in params && 'org.keyoxide.r' in params) {
|
||||
profileUrl = `https://matrix.to/#/@${match[1]}`
|
||||
eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}`
|
||||
proofUrl = utils.generateProxyURL(
|
||||
'matrix',
|
||||
[params['org.keyoxide.r'], params['org.keyoxide.e']],
|
||||
opts
|
||||
)
|
||||
}
|
||||
if (!match[2]) {
|
||||
return null
|
||||
}
|
||||
|
||||
const params = queryString.parse(match[2])
|
||||
|
||||
if (!('org.keyoxide.e' in params && 'org.keyoxide.r' in params)) {
|
||||
return null
|
||||
}
|
||||
|
||||
const profileUrl = `https://matrix.to/#/@${match[1]}`
|
||||
const eventUrl = `https://matrix.to/#/${params['org.keyoxide.r']}/${params['org.keyoxide.e']}`
|
||||
|
||||
return {
|
||||
serviceprovider: {
|
||||
type: 'communication',
|
||||
|
@ -56,17 +49,22 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: eventUrl,
|
||||
fetch: proofUrl,
|
||||
access: proofAccess.GRANTED,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.MATRIX,
|
||||
access: E.ProofAccess.GRANTED,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
eventId: params['org.keyoxide.e'],
|
||||
roomId: params['org.keyoxide.r'],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['data', 'content', 'body'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: `${uri}/api/config`,
|
||||
fetch: null,
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.GENERIC,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `${uri}/api/config`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.FINGERPRINT,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['socialHandles', 'url'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/
|
||||
|
||||
|
@ -35,17 +35,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`,
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
request: {
|
||||
fetcher: E.Fetcher.HTTP,
|
||||
access: E.ProofAccess.NOCORS,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
url: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`,
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: ['data', 'children', 'data', 'selftext'],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const E = require('../enums')
|
||||
const bent = require('bent')
|
||||
const req = bent('GET')
|
||||
const serviceproviders = require('../serviceproviders')
|
||||
|
@ -82,17 +82,21 @@ const processURI = (uri, opts) => {
|
|||
},
|
||||
proof: {
|
||||
uri: uri,
|
||||
fetch: utils.generateProxyURL('twitter', match[2], opts),
|
||||
access: proofAccess.GRANTED,
|
||||
format: proofFormat.TEXT,
|
||||
request: {
|
||||
fetcher: E.Fetcher.TWITTER,
|
||||
access: E.ProofAccess.GRANTED,
|
||||
format: E.ProofFormat.TEXT,
|
||||
data: {
|
||||
tweetId: match[2],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: [],
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
const utils = require('../utils')
|
||||
const E = require('../enums')
|
||||
|
||||
const reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
||||
|
||||
|
@ -35,18 +34,23 @@ const processURI = (uri, opts) => {
|
|||
qr: uri,
|
||||
},
|
||||
proof: {
|
||||
uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts),
|
||||
fetch: null,
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
uri: null,
|
||||
request: {
|
||||
fetcher: E.Fetcher.XMPP,
|
||||
access: E.ProofAccess.SERVER,
|
||||
format: E.ProofFormat.JSON,
|
||||
data: {
|
||||
username: match[1],
|
||||
service: match[2],
|
||||
}
|
||||
}
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
format: E.ClaimFormat.MESSAGE,
|
||||
relation: E.ClaimRelation.CONTAINS,
|
||||
path: [],
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue