@@ -62,7 +62,9 @@ export default class PocketProvider {
6262 private accessToken : string | null ;
6363 private authConfigPath : string ;
6464
65- private readonly CONSUMER_KEY = "108332-4cb01719bb01deabce69438" ;
65+ // Allow env var overrides to point to custom Pocket-compatible servers
66+ public readonly BASE_URL = process . env . POCKET_BASE_URL ?? "https://getpocket.com" ;
67+ private readonly CONSUMER_KEY = process . env . POCKET_API_CONSUMER_KEY ?? "108332-4cb01719bb01deabce69438" ;
6668 private readonly BASE_SEARCH_PARAMS : PocketApiSearchParams = {
6769 detailType : "simple" ,
6870 count : 60 ,
@@ -122,7 +124,7 @@ export default class PocketProvider {
122124 const redirectUrl = `http://${ req . headers . host } /pocket/oauth` ;
123125 try {
124126 const data = ( await got
125- . post ( "https://getpocket.com /v3/oauth/request" , {
127+ . post ( ` ${ this . BASE_URL } /v3/oauth/request` , {
126128 headers : {
127129 Accept : "*/*" ,
128130 "X-Accept" : "application/json" ,
@@ -139,7 +141,7 @@ export default class PocketProvider {
139141 request_token : this . code ,
140142 redirect_uri : redirectUrl ,
141143 } ) ;
142- const authorizeUrl = `https://getpocket.com /auth/authorize?${ authorizeQuery } ` ;
144+ const authorizeUrl = `${ this . BASE_URL } /auth/authorize?${ authorizeQuery } ` ;
143145 res . redirect ( authorizeUrl ) ;
144146 return ;
145147 } catch ( e ) {
@@ -152,7 +154,7 @@ export default class PocketProvider {
152154 // We should now be able to exchange our 'code' for an access token
153155 try {
154156 const data = ( await got
155- . post ( "https://getpocket.com /v3/oauth/authorize" , {
157+ . post ( ` ${ this . BASE_URL } /v3/oauth/authorize` , {
156158 headers : {
157159 Accept : "*/*" ,
158160 "X-Accept" : "application/json" ,
@@ -285,7 +287,7 @@ export default class PocketProvider {
285287
286288 private async getStories ( searchParams : PocketApiSearchParams ) {
287289 const data = await got
288- . post ( "https://getpocket.com /v3/get" , {
290+ . post ( ` ${ this . BASE_URL } /v3/get` , {
289291 headers : {
290292 Accept : "*/*" ,
291293 "X-Accept" : "application/json" ,
0 commit comments