mirror of
https://codeberg.org/keyoxide/doipjs.git
synced 2024-12-22 14:39:28 -07:00
feat: Replace devto with forem
This commit is contained in:
parent
e85d77045c
commit
322b2c4529
2 changed files with 14 additions and 14 deletions
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||||
*/
|
*/
|
||||||
const E = require('../enums')
|
const E = require('../enums')
|
||||||
|
|
||||||
const reURI = /^https:\/\/dev\.to\/(.*)\/(.*)\/?/
|
const reURI = /^https:\/\/(.*)\/(.*)\/(.*)\/?/
|
||||||
|
|
||||||
const processURI = (uri) => {
|
const processURI = (uri) => {
|
||||||
const match = uri.match(reURI)
|
const match = uri.match(reURI)
|
||||||
|
@ -23,15 +23,15 @@ const processURI = (uri) => {
|
||||||
return {
|
return {
|
||||||
serviceprovider: {
|
serviceprovider: {
|
||||||
type: 'web',
|
type: 'web',
|
||||||
name: 'devto'
|
name: 'forem'
|
||||||
},
|
},
|
||||||
match: {
|
match: {
|
||||||
regularExpression: reURI,
|
regularExpression: reURI,
|
||||||
isAmbiguous: false
|
isAmbiguous: false
|
||||||
},
|
},
|
||||||
profile: {
|
profile: {
|
||||||
display: match[1],
|
display: `${match[2]}@${match[1]}`,
|
||||||
uri: `https://dev.to/${match[1]}`,
|
uri: `https://${match[1]}/${match[2]}`,
|
||||||
qr: null
|
qr: null
|
||||||
},
|
},
|
||||||
proof: {
|
proof: {
|
||||||
|
@ -41,7 +41,7 @@ const processURI = (uri) => {
|
||||||
access: E.ProofAccess.NOCORS,
|
access: E.ProofAccess.NOCORS,
|
||||||
format: E.ProofFormat.JSON,
|
format: E.ProofFormat.JSON,
|
||||||
data: {
|
data: {
|
||||||
url: `https://dev.to/api/articles/${match[1]}/${match[2]}`,
|
url: `https://${match[1]}/api/articles/${match[2]}/${match[3]}`,
|
||||||
format: E.ProofFormat.JSON
|
format: E.ProofFormat.JSON
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,16 +55,16 @@ const processURI = (uri) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const tests = [
|
const tests = [
|
||||||
{
|
|
||||||
uri: 'https://dev.to/alice/post',
|
|
||||||
shouldMatch: true
|
|
||||||
},
|
|
||||||
{
|
|
||||||
uri: 'https://dev.to/alice/post/',
|
|
||||||
shouldMatch: true
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
uri: 'https://domain.org/alice/post',
|
uri: 'https://domain.org/alice/post',
|
||||||
|
shouldMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uri: 'https://domain.org/alice/post/',
|
||||||
|
shouldMatch: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
uri: 'https://domain.org/alice',
|
||||||
shouldMatch: false
|
shouldMatch: false
|
||||||
}
|
}
|
||||||
]
|
]
|
|
@ -26,7 +26,7 @@ const data = {
|
||||||
lichess: require('./lichess'),
|
lichess: require('./lichess'),
|
||||||
hackernews: require('./hackernews'),
|
hackernews: require('./hackernews'),
|
||||||
lobsters: require('./lobsters'),
|
lobsters: require('./lobsters'),
|
||||||
devto: require('./devto'),
|
forem: require('./forem'),
|
||||||
// forgejo: require('./forgejo'),
|
// forgejo: require('./forgejo'),
|
||||||
gitea: require('./gitea'),
|
gitea: require('./gitea'),
|
||||||
gitlab: require('./gitlab'),
|
gitlab: require('./gitlab'),
|
||||||
|
|
Loading…
Reference in a new issue