File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ new OptionsSync().define({
77 defaults : {
88 disabledFeatures : '' ,
99 customCSS : '' ,
10+ personalToken : '' ,
1011 logging : false
1112 } ,
1213 migrations : [
Original file line number Diff line number Diff line change 1+ import OptionsSync from 'webext-options-sync' ;
2+
13const cache = new Map ( ) ;
24
35export default async endpoint => {
46 if ( cache . has ( endpoint ) ) {
57 return cache . get ( endpoint ) ;
68 }
9+ const headers = { } ;
10+ const { personalToken} = await new OptionsSync ( ) . getAll ( ) ;
11+ if ( personalToken ) {
12+ headers . Authorization = `token ${ personalToken } ` ;
13+ }
714 const api = location . hostname === 'github.com' ? 'https://api.github.com/' : `${ location . origin } /api/` ;
8- const response = await fetch ( api + endpoint ) ;
15+ const response = await fetch ( api + endpoint , { headers } ) ;
916 const json = await response . json ( ) ;
1017 cache . set ( endpoint , json ) ;
1118 return json ;
Original file line number Diff line number Diff line change 11body {
22 min-width : 430px ; /* Required to size the Browser Action popup */
33}
4+ : root {
5+ --github-green : # 28a745 ;
6+ --github-red : # cb2431 ;
7+ }
8+ input : not ([type='checkbox']): not (: placeholder-shown ): valid {
9+ color : var (--github-green );
10+ border : 1px solid;
11+ }
12+ input : not ([type='checkbox']): invalid {
13+ color : var (--github-red );
14+ border : 1px solid;
15+ }
16+ input : not ([type='checkbox']),
417textarea {
518 display : block;
619 width : 100% ;
Original file line number Diff line number Diff line change @@ -23,6 +23,18 @@ <h2 class="only-firefox">Options</h2>
2323 </ label >
2424 </ p >
2525
26+ < hr >
27+
28+ < p >
29+ < label >
30+ < strong > Personal token</ strong > , < a href ="https://github.com/settings/tokens/new?description=Refined%20GitHub " target ="_blank "> found here</ a > (for high rate API calls and private repos)< br >
31+ <!-- placeholder is set to enable use of :placeholder-shown CSS selector -->
32+ < input name ="personalToken " spellcheck ="false " autocomplete ="off " size ="40 " maxlength ="40 " pattern ="[\da-f]{40} " placeholder =" "> </ input >
33+ </ label >
34+ </ p >
35+
36+ < hr >
37+
2638 < p >
2739 < label >
2840 < input type ="checkbox " name ="logging ">
You can’t perform that action at this time.
0 commit comments