forked from Mirrors/doipjs
Update serviceProviders with enums
This commit is contained in:
parent
8dc0372ea7
commit
10a32f98a5
17 changed files with 101 additions and 72 deletions
|
@ -13,6 +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 reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://dev.to/api/articles/${match[1]}/${match[2]}`,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['body_markdown'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/(.*)\/u\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://${match[1]}/u/${match[2]}.json`,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['user', 'bio_raw'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,10 +13,11 @@ 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 utils = require('../utils')
|
||||
|
||||
const reURI = /^dns:([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
||||
|
||||
const customRequestHandler = async (spData, opts) => {
|
||||
|
@ -61,16 +62,16 @@ const processURI = (uri, opts) => {
|
|||
qr: null,
|
||||
},
|
||||
proof: {
|
||||
uri: utils.generateProxyURL('dns', match[1], opts),
|
||||
uri: null,
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'uri',
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['records', 'txt'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/(.*)\/users\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'fingerprint',
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['summary'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/(.*)\/(.*)\/gitea_proof\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://${match[1]}/api/v1/repos/${match[2]}/gitea_proof`,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.EQUALS,
|
||||
path: ['description'],
|
||||
relation: 'equals',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/gist\.github\.com\/(.*)\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://api.github.com/gists/${match[2]}`,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['files', 'openpgp.md', 'content'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 bent = require('bent')
|
||||
const req = bent('GET')
|
||||
|
||||
|
@ -77,14 +78,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.EQUALS,
|
||||
path: ['description'],
|
||||
relation: 'equals',
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/news\.ycombinator\.com\/user\?id=(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: `https://hacker-news.firebaseio.com/v0/user/${match[1]}.json`,
|
||||
fetch: null,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'uri',
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['about'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ 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 reURI = /^irc\:\/\/(.*)\/([a-zA-Z0-9]*)/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -35,14 +37,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: utils.generateProxyURL('irc', [match[1], match[2]], opts),
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'uri',
|
||||
format: claimFormat.URI,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: [],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/liberapay\.com\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://liberapay.com/${match[1]}/public.json`,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['statements', 'content'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/lobste\.rs\/u\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: `https://lobste.rs/u/${match[1]}.json`,
|
||||
fetch: null,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['about'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/(.*)\/@(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'fingerprint',
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['attachment', 'value'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@ 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 queryString = require('query-string')
|
||||
const utils = require('../utils')
|
||||
|
||||
const reURI = /^matrix\:u\/(?:\@)?([^@:]*\:[^?]*)(\?.*)?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -55,14 +57,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: eventUrl,
|
||||
fetch: proofUrl,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GRANTED,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['data', 'content', 'body'],
|
||||
relation: 'contains',
|
||||
},
|
||||
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 bent = require('bent')
|
||||
const req = bent('GET')
|
||||
const { proofAccess, proofFormat, claimFormat, claimRelation } = require('../enums')
|
||||
|
||||
const reURI = /^https:\/\/(.*)/
|
||||
|
||||
|
@ -37,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: `${uri}/api/config`,
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.GENERIC,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'fingerprint',
|
||||
format: claimFormat.FINGERPRINT,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['socialHandles', 'url'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,6 +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 reURI = /^https:\/\/(?:www\.)?reddit\.com\/user\/(.*)\/comments\/(.*)\/(.*)\/?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -34,14 +36,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: `https://www.reddit.com/user/${match[1]}/comments/${match[2]}.json`,
|
||||
useProxy: true,
|
||||
format: 'json',
|
||||
access: proofAccess.NOCORS,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: ['data', 'children', 'data', 'selftext'],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
|
@ -13,10 +13,12 @@ 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 serviceproviders = require('../serviceproviders')
|
||||
const utils = require('../utils')
|
||||
|
||||
const reURI = /^https:\/\/twitter\.com\/(.*)\/status\/([0-9]*)(?:\?.*)?/
|
||||
|
||||
const customRequestHandler = async (spData, opts) => {
|
||||
|
@ -81,14 +83,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: uri,
|
||||
fetch: utils.generateProxyURL('twitter', match[2], opts),
|
||||
useProxy: false,
|
||||
format: 'text',
|
||||
access: proofAccess.GRANTED,
|
||||
format: proofFormat.TEXT,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: [],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: customRequestHandler,
|
||||
}
|
||||
|
|
|
@ -13,7 +13,9 @@ 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 reURI = /^xmpp:([a-zA-Z0-9\.\-\_]*)@([a-zA-Z0-9\.\-\_]*)(?:\?(.*))?/
|
||||
|
||||
const processURI = (uri, opts) => {
|
||||
|
@ -35,14 +37,14 @@ const processURI = (uri, opts) => {
|
|||
proof: {
|
||||
uri: utils.generateProxyURL('xmpp', `${match[1]}@${match[2]}`, opts),
|
||||
fetch: null,
|
||||
useProxy: false,
|
||||
format: 'json',
|
||||
access: proofAccess.SERVER,
|
||||
format: proofFormat.JSON,
|
||||
},
|
||||
claim: {
|
||||
fingerprint: null,
|
||||
format: 'message',
|
||||
format: claimFormat.MESSAGE,
|
||||
relation: claimRelation.CONTAINS,
|
||||
path: [],
|
||||
relation: 'contains',
|
||||
},
|
||||
customRequestHandler: null,
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue