mirror of
https://codeberg.org/keyoxide/keyoxide-web.git
synced 2024-12-22 23:09:29 -07:00
Added dev.to identity proof
This commit is contained in:
parent
8debc6de92
commit
e50a137f89
2 changed files with 24 additions and 0 deletions
|
@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
## [0.2.1] - 2020-07-16
|
## [0.2.1] - 2020-07-16
|
||||||
|
### Added
|
||||||
|
- dev.to identity proof
|
||||||
### Fixed
|
### Fixed
|
||||||
- Make www optional for reddit regex
|
- Make www optional for reddit regex
|
||||||
|
|
||||||
|
|
|
@ -433,6 +433,28 @@ async function verifyProof(url, fingerprint) {
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// dev.to
|
||||||
|
if (/^https:\/\/dev\.to\//.test(url)) {
|
||||||
|
output.type = "dev.to";
|
||||||
|
match = url.match(/https:\/\/dev\.to\/(.*)\/(.*)/);
|
||||||
|
output.display = match[1];
|
||||||
|
output.url = `https://dev.to/${match[1]}`;
|
||||||
|
output.proofUrlFetch = `https://dev.to/api/articles/${match[1]}/${match[2]}`;
|
||||||
|
try {
|
||||||
|
response = await fetch(output.proofUrlFetch);
|
||||||
|
if (!response.ok) {
|
||||||
|
throw new Error('Response failed: ' + response.status);
|
||||||
|
}
|
||||||
|
json = await response.json();
|
||||||
|
reVerify = new RegExp(`[Verifying my OpenPGP key: openpgp4fpr:${fingerprint}]`, 'i');
|
||||||
|
if (reVerify.test(json.body_markdown)) {
|
||||||
|
output.isVerified = true;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
} finally {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Reddit
|
// Reddit
|
||||||
if (/^https:\/\/(?:www\.)?reddit\.com\/user/.test(url)) {
|
if (/^https:\/\/(?:www\.)?reddit\.com\/user/.test(url)) {
|
||||||
output.type = "reddit";
|
output.type = "reddit";
|
||||||
|
|
Loading…
Reference in a new issue