Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions lib/feedly.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,15 @@ class Feedly {
* @param {String} [options.base] - The root URL of the API.
* (default: 'http://cloud.feedly.com')
* @param {String} [options.config_file] - File in which state information such
* as the access token and refresh tokens are stored. Tildes are expanded
* as needed. (default: '~/.feedly')
* as the access token and refresh tokens are stored. Tildes are expanded
* as needed. Tokens can also be provided manually as options.
* (default: '~/.feedly')
* @param {String} [options.refresh_token] - User account refresh token.
* (default: undefined)
* @param {String} [options.access_token] - User account access token.
* (default: undefined)
* @param {String} [options.access_token_expires] - Time when the user account
* access token expires in milliseconds. (default: 0)
* @param {String} [options.html_file] - File that contains the HTML to give to
* the web browser after it is redirected to the one-shot web server that
* we'll be running. (default: '../html/index.html')
Expand All @@ -98,6 +105,9 @@ class Feedly {
port: 0,
base: 'http://cloud.feedly.com',
config_file: '~/.feedly',
refresh_token: undefined,
access_token: undefined,
access_token_expires: 0,
html_file: path.join(__dirname, '../html/index.html'),
html_text: 'No HTML found',
slop: 3600000,
Expand All @@ -110,6 +120,13 @@ class Feedly {
throw new Error('client_id and client_secret required')
}
this.state = {}
if (this.options.refresh_token && this.options.access_token && this.options.access_token_expires) {
this.state = {
refresh_token: this.options.refresh_token,
access_token: this.options.access_token,
expires: this.options.access_token_expires
}
}

// allSettled ignores errors
this.ready = Promise.all([this._loadConfig(), this._loadHTML()])
Expand Down