mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-05-15 14:38:03 +02:00
feat: gist & co-authors
This commit is contained in:
@@ -147,6 +147,17 @@ function generateRandomId(length) {
|
||||
|
||||
function parseGithubUrl(url) {
|
||||
if (!url) throw "Invalid url";
|
||||
// Gist URLs: https://gist.github.com/<owner>/<gistId> or
|
||||
// https://gist.github.com/<gistId>
|
||||
const gistMatch = url.match(
|
||||
/gist\.github\.com\/(?:(?<owner>[\w-\._]+)\/)?(?<gist>[a-fA-F0-9]+)/
|
||||
);
|
||||
if (gistMatch && gistMatch.groups.gist) {
|
||||
return {
|
||||
owner: gistMatch.groups.owner,
|
||||
gistId: gistMatch.groups.gist,
|
||||
};
|
||||
}
|
||||
const matches = url
|
||||
.replace(/\.git(\/|$)/, "$1")
|
||||
.match(
|
||||
|
||||
Reference in New Issue
Block a user