Skip to content

Commit

Permalink
西元2025年01月05日 (週日) 23時12分46秒 CST
Browse files Browse the repository at this point in the history
  • Loading branch information
pulipulichen committed Jan 5, 2025
1 parent e12b48f commit 794f5e5
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions GitHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

const apiUrl = "https://api.github.com/";


function detectWeb(doc, url) {
if (url.includes("/search?")) {
if (getSearchResults(doc, true)) {
Expand All @@ -58,7 +57,25 @@ function detectWeb(doc, url) {
return false;
}

return "computerProgram";
return new Promise(function (resolve) {
ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) {

Check failure on line 61 in GitHub.js

View workflow job for this annotation

GitHub Actions / Lint, Check, Test

'path' is not defined
if (xhr.status !== 200) {
return resolve("computerProgram");
}
try {
let type = searchFieldValue(cffText, "type");
if (type && type === 'dataset') {
return resolve(type);
}
}
catch (e) {
console.error(`CITATION.cff format is invalid:
${cffText}`);
}
return resolve("computerProgram");
}, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false);
});
}


Expand Down

0 comments on commit 794f5e5

Please sign in to comment.