Frozenfire92 / Pages2Repo

A chrome extension to open a repository from a GitHub page
https://chrome.google.com/webstore/detail/pages2repo/afnogakjnebbgcbjkgmhaccljfejeflh
The Unlicense
38 stars 11 forks source link

Be able to test for github account pages blog #11

Open Frozenfire92 opened 9 years ago

Frozenfire92 commented 9 years ago

For example https://chiefy.github.io/2014/09/03/sails-generate-ember.html attempts to look up the repo 2014 for chiefy, if this check fails the script should see if chiefy.github.io is valid

Frozenfire92 commented 9 years ago

Issue being is the way that background.js works might not allow this in the most direct way. Currently it uses a regex to get the username and repo in the format

username.github.io/reponame/don'tcareabout/anythinghere

It then uses this username and reponame combo to look in localstorage for it. If it exists and is fresh it uses that. If it exists and is over a day old, or doesn't exist, it asks github.js to retrieve it. If github.js were to attempt to look for username.github.io when it doesn't find 2014 (as above) it would then store it with a reponame of username.github.io, which wouldn't be queried for from background.js. It could however be stored as reponame 2014, but this will then store a lot of the same object if there were other years or paths (/2015, /blog, etc)

I'm not sure if there is an easy way to go about this, or even worth the effort

Glavin001 commented 9 years ago

https://chiefy.github.io/ maps to https://github.com/chiefy/chiefy.github.io

2014 is not a repo, it's a directory in the repo. See https://github.com/chiefy/chiefy.github.io/tree/master/2014

Update: Oh, I see. You knew that, and was pointing out how it is currently working.

So here is an example:

I think you're right. Check for reponame and if that fails, fallback to checking username.github.io as the repo name.