Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgodhani committed Feb 27, 2021
1 parent 8801d70 commit 467d92f
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 81 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "raven-reader",
"productName": "Raven Reader",
"version": "1.0.43",
"version": "1.0.44",
"author": "Hello Efficiency Inc. <welcome@helloefficiency.com>",
"description": "Simple desktop RSS Reader",
"license": "MIT",
Expand Down
4 changes: 4 additions & 0 deletions src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,10 @@ ipcMain.on('get-settings', (event, arg) => {
event.returnValue = state
})

ipcMain.on('get-setting-item', (event, arg) => {
event.returnValue = store.get(arg)
})

ipcMain.handle('set-settings-item', (event, arg) => {
switch (arg.type) {
case 'set':
Expand Down
3 changes: 3 additions & 0 deletions src/bridge/electronstore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ const electronStoreBridge = {
getIsDarkMode: () => {
return ipcRenderer.sendSync('get-dark')
},
getSettingItem: (key) => {
return ipcRenderer.sendSync('get-setting-item', key)
},
storeSetSettingItem: (type, key, data = null) => {
ipcRenderer.invoke('set-settings-item', {
type: type,
Expand Down
58 changes: 19 additions & 39 deletions src/services/inoreader.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,9 @@ function getCoverImage (postContent) {

export default {
async getUserInfo (credsData) {
let tokenData
if (dayjs().valueOf() >= credsData.expires_in) {
tokenData = await this.refreshToken(credsData)
} else {
tokenData = credsData
}
const data = await axios.get('https://www.inoreader.com/reader/api/0/user-info', {
headers: {
Authorization: `Bearer ${tokenData.access_token}`
Authorization: `Bearer ${credsData.access_token}`
}
})
return data.data
Expand All @@ -62,25 +56,26 @@ export default {
grant_type: 'refresh_token',
refresh_token: credsData.refresh_token
})
data.data.expires_in = dayjs().add(data.data.expires_in).valueOf()
window.electronstore.storeSetSettingItem('set', 'inoreader_creds', JSON.stringify(data.data))
return data.data
const currentData = Object.assign({}, JSON.parse(window.electronstore.getSettingItem('inoreader_creds')))
const userInfo = await this.getUserInfo(data.data)
currentData.user = userInfo
currentData.expires_in = dayjs().add(data.data.expires_in).valueOf()
currentData.access_token = data.data.access_token
store.dispatch('setInoreader', currentData)
return currentData
} catch (e) {
window.log.info(e)
}
},
async getSubscriptions (credsData) {
let tokenData
checkToken (credsData) {
const currentTime = dayjs().valueOf()
if (currentTime >= credsData.expires_in) {
tokenData = await this.refreshToken(credsData)
} else {
tokenData = credsData
}
return currentTime >= credsData.expires_in
},
async getSubscriptions (credsData) {
try {
const subscriptions = await axios.get('https://www.inoreader.com/reader/api/0/subscription/list', {
headers: {
Authorization: `Bearer ${tokenData.access_token}`
Authorization: `Bearer ${credsData.access_token}`
}
})
return subscriptions.data.subscriptions
Expand All @@ -89,15 +84,9 @@ export default {
}
},
async getUnreadIds (credsData) {
let tokenData
const ids = []
let continuation = null
let apiUrl
if (dayjs().valueOf() >= credsData.expires_in) {
tokenData = await this.refreshToken(credsData)
} else {
tokenData = credsData
}
try {
do {
if (continuation === null) {
Expand All @@ -107,7 +96,7 @@ export default {
}
const data = await axios.get(apiUrl, {
headers: {
Authorization: `Bearer ${tokenData.access_token}`
Authorization: `Bearer ${credsData.access_token}`
}
})
if (data.data.itemRefs) {
Expand All @@ -124,15 +113,9 @@ export default {
}
},
async getStarredIds (credsData) {
let tokenData
const ids = []
let continuation = null
let apiUrl
if (dayjs().valueOf() >= credsData.expires_in) {
tokenData = await this.refreshToken(credsData)
} else {
tokenData = credsData
}
try {
do {
if (continuation === null) {
Expand All @@ -142,7 +125,7 @@ export default {
}
const data = await axios.get(apiUrl, {
headers: {
Authorization: `Bearer ${tokenData.access_token}`
Authorization: `Bearer ${credsData.access_token}`
}
})
if (data.data.itemRefs) {
Expand All @@ -159,14 +142,8 @@ export default {
}
},
async getEntries (credsData, ids) {
let tokenData
const entries = []
const chunks = chunk(ids, 250)
if (dayjs().valueOf() >= credsData.expires_in) {
tokenData = await this.refreshToken(credsData)
} else {
tokenData = credsData
}
try {
for (let i = 0; i < chunks.length; i++) {
const postData = new URLSearchParams()
Expand All @@ -175,7 +152,7 @@ export default {
}
const data = await axios.post('https://www.inoreader.com/reader/api/0/stream/items/contents?output=json', postData, {
headers: {
Authorization: `Bearer ${tokenData.access_token}`
Authorization: `Bearer ${credsData.access_token}`
}
})
entries.push(...data.data.items)
Expand Down Expand Up @@ -236,6 +213,9 @@ export default {
}
},
async syncArticles (credsData) {
if (this.checkToken(credsData)) {
credsData = await this.refreshToken(credsData)
}
let subscriptions = await this.getSubscriptions(credsData)
const unreadList = await this.getUnreadIds(credsData)
const starredList = await this.getStarredIds(credsData)
Expand Down
82 changes: 41 additions & 41 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -880,45 +880,45 @@
lodash "^4.17.19"
to-fast-properties "^2.0.0"

"@cliqz/adblocker-content@^1.20.2":
version "1.20.2"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.20.2.tgz#2cfb556b2b8ef6c5fdcfc0fccf593eccfb7038a2"
integrity sha512-vnAj78tqxZdjZ1gY0KL5TmBH7bUkwXOD2VDnQUEdFO+s6Ubj8WdhEY7gQ4C7guNhDfMW6PULfjWGtR6stEjfDA==
"@cliqz/adblocker-content@^1.20.3":
version "1.20.3"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-content/-/adblocker-content-1.20.3.tgz#198c8719cd62ef3c67a5c98e7a54336b7812ed86"
integrity sha512-aCBTiIiNgVbmDIQyUcsn0j3n+umvs0DuVlL6dccPE3qfeFxT4whUvMwjxUS2/dIBfJK9A1LywmvVke2eSPw9wg==
dependencies:
"@cliqz/adblocker-extended-selectors" "^1.20.2"
"@cliqz/adblocker-extended-selectors" "^1.20.3"

"@cliqz/adblocker-electron-preload@^1.20.2":
version "1.20.2"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.20.2.tgz#131fe6686427149ce674a792d93f2b6c1e536130"
integrity sha512-LTBdrnNviKjm9LsWpldAkx7sQIWBNP4GKeizck/7hO402pSNV/J5mhFRMEmykJGqZKMEGR08Tssbj4EYqzIadg==
"@cliqz/adblocker-electron-preload@^1.20.3":
version "1.20.3"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron-preload/-/adblocker-electron-preload-1.20.3.tgz#17dff446ad742cb6e68a4572e7a75cff1fa33f95"
integrity sha512-fWAFEGj+F0VOUKZd2FqWLuguXmGzkRQz5wTCqasvndX4HSe0P8Pd2666pWK9RJW1dLJE7U61mQfTbYqlUFVTMA==
dependencies:
"@cliqz/adblocker-content" "^1.20.2"
"@cliqz/adblocker-content" "^1.20.3"

"@cliqz/adblocker-electron@^1.20.0":
version "1.20.2"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.20.2.tgz#727493ce2ad2fbd986be75312a7039d6a6a1ff68"
integrity sha512-WS+/6V5CWkSQKmOH4NZb92mIWaGQXW5VJEHB2JgQ94uGg1W/eV7KZggXCQCzj3SZ9scVE1U5kNAhgM2qsQ/Yww==
version "1.20.3"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-electron/-/adblocker-electron-1.20.3.tgz#f2b4bf5dddf90f64251c46f89238526dc0037384"
integrity sha512-ZcEl3W7R/aoUA0IPIMtvdn7gVE6O9+rDQ9OllIH/s/gVeElXZsgPEtpPMSuoJWbi9d2mlr8yo3UFvkV3u7c4gw==
dependencies:
"@cliqz/adblocker" "^1.20.2"
"@cliqz/adblocker-electron-preload" "^1.20.2"
"@cliqz/adblocker" "^1.20.3"
"@cliqz/adblocker-electron-preload" "^1.20.3"
tldts-experimental "^5.6.21"

"@cliqz/adblocker-extended-selectors@^1.20.2":
version "1.20.2"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.20.2.tgz#c45a864c94388c48b535ea4ccc73c22d6c9e29a3"
integrity sha512-zk3sSlJlVMGJICZxjJLZxMZ0us/0mAvzFKCcXyOckOIJAxU40KdRp6RpdagxbM2fmKiKPOQtPJ71I4qhbatCgw==
"@cliqz/adblocker-extended-selectors@^1.20.3":
version "1.20.3"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker-extended-selectors/-/adblocker-extended-selectors-1.20.3.tgz#a817915948ec4e64c8b878a80a71d911ea0412c8"
integrity sha512-Xsrqg4qgpNVx80UJrAz/nS8jcbgCTIGvir0MrjoXrw0GheqRxsgE540XXP9JA7QlifLNVEOO44DpHvhUmISkQw==

"@cliqz/adblocker@^1.20.2":
version "1.20.2"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.20.2.tgz#047e881ca9e6e1c21ac0e2ac7a5a762cb81f4fb7"
integrity sha512-7E6qHPeApjyzzNDKn07Uc8yXbbXpUGrqaXsVf3IWtcpc0FTom67SEW05bR7ZzXZqDsb25d/WcvBdd9vDbwqk8A==
"@cliqz/adblocker@^1.20.3":
version "1.20.3"
resolved "https://registry.yarnpkg.com/@cliqz/adblocker/-/adblocker-1.20.3.tgz#4e8d03ed03c476f7b4388d25f910b1b9e0b15cc9"
integrity sha512-Dqj8fJ399kFsFQ53uW0ajA5jH5VJ5ppawOjtoV2s+7NILj1ydvw40jTrr3l/ObMvxaAGaDUj2Euo4beg3/EtRQ==
dependencies:
"@cliqz/adblocker-content" "^1.20.2"
"@cliqz/adblocker-extended-selectors" "^1.20.2"
"@cliqz/adblocker-content" "^1.20.3"
"@cliqz/adblocker-extended-selectors" "^1.20.3"
"@remusao/guess-url-type" "^1.1.2"
"@remusao/small" "^1.1.2"
"@remusao/smaz" "^1.7.1"
"@types/chrome" "^0.0.130"
"@types/chrome" "^0.0.133"
"@types/firefox-webext-browser" "^82.0.0"
tldts-experimental "^5.6.21"

Expand Down Expand Up @@ -1497,10 +1497,10 @@
"@types/node" "*"
"@types/responselike" "*"

"@types/chrome@^0.0.130":
version "0.0.130"
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.130.tgz#cde0934f673474794c01209bde84a4fc69987b23"
integrity sha512-pAHbcPeOmjNCF5EoUCAZk3+5lll1yyIDP+CZRNf1Dk8LaANkNBNZ5szHqeYYVjMyEGP6yIFeaO+Y7qNpz1hVOw==
"@types/chrome@^0.0.133":
version "0.0.133"
resolved "https://registry.yarnpkg.com/@types/chrome/-/chrome-0.0.133.tgz#9e1d55441584ba2d5274ca84db36427da9c5dc6e"
integrity sha512-G8uIUdaCTBILprQvQXBWGXZxjAWbkCkFQit17cdH3zYQEwU8f/etNl8+M7e8MRz9Xj8daHaVpysneMZMx8/ldQ==
dependencies:
"@types/filesystem" "*"
"@types/har-format" "*"
Expand Down Expand Up @@ -6581,9 +6581,9 @@ i18next-electron-language-detector@^0.0.10:
integrity sha512-l/CdtK5i6BB7h5OGKadUK+Q0q4e4EYXZSDV+Hetxjdv4C8RoYPNbqfTIpcc4RpIO3Dty05Xt8TxV+HyFd6opeA==

i18next-fs-backend@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/i18next-fs-backend/-/i18next-fs-backend-1.0.8.tgz#f03d911cac31d76bd6b0aa73fa9c7fc45a199e1d"
integrity sha512-1TyOJEGBvwqdIu0vZo/pcAxPXe/0vqOX6/hgsgTnNpcGe0PyHJ/87ABDdwdwfKJSxbtM0j6Pue0NKFcx6rOeJg==
version "1.1.0"
resolved "https://registry.yarnpkg.com/i18next-fs-backend/-/i18next-fs-backend-1.1.0.tgz#3baa63bfb6fd00a331b91d186776cd886b46d2f6"
integrity sha512-QfzfrEYEsLsDC5sZsdSQl5fVYg8I5KrJynnWN7xgSU5yfClbBJ009mtNxUszR0uABQZ8PRr2gj3bN9+RNORBlg==

i18next@^19.8.7:
version "19.9.0"
Expand Down Expand Up @@ -11391,17 +11391,17 @@ tinycolor2@^1.4.1:
resolved "https://registry.yarnpkg.com/tinycolor2/-/tinycolor2-1.4.2.tgz#3f6a4d1071ad07676d7fa472e1fac40a719d8803"
integrity sha512-vJhccZPs965sV/L2sU4oRQVAos0pQXwsvTLkWYdqJ+a8Q5kPFzJTuOFwy7UniPli44NKQGAglksjvOcpo95aZA==

tldts-core@^5.7.8:
version "5.7.8"
resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-5.7.8.tgz#8c441951e4c6157d45f84219c8c41483a8d5ee90"
integrity sha512-F0A6r4fGkAdyPpTWN3elMVMsflmJGs26v9KzUCM1M7ZzMPiwQ2uk7VgiQHO+ge8WVgSSx96jFn9h30Vqeci8Ig==
tldts-core@^5.7.10:
version "5.7.10"
resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-5.7.10.tgz#7a059aea5c4a5f52043566daa271bbd31e80d945"
integrity sha512-GtARO1mP2SFCQWCbSsemf/tG+dLuNLz8RCLmXoPuxh7H3NIPfZ/fo2jTQkMHWnOf1kpOMJwd3vPElkgS/2KYDg==

tldts-experimental@^5.6.21:
version "5.7.8"
resolved "https://registry.yarnpkg.com/tldts-experimental/-/tldts-experimental-5.7.8.tgz#fa3c74dbdd39be107bf0f9864e8e2b9b598f975b"
integrity sha512-sIRF4gjyK8ajEQ6+6uKBhxgIeAI5YIoriZpX/Yh7ANTwlwJBxRxzPIla53JEYYttSf3hbWRrTzDStYXNcWEHJQ==
version "5.7.10"
resolved "https://registry.yarnpkg.com/tldts-experimental/-/tldts-experimental-5.7.10.tgz#961b3f585134c9d9449ad4400d2285df50bccfd6"
integrity sha512-wksna7o/vUJmZO1vfuJjYEKmOjTJSwq0wOzGWliTbxoB4FPzigLz+ZK4kbCkzfRdFD3fR5ZNAoH6xFqZ55rp1A==
dependencies:
tldts-core "^5.7.8"
tldts-core "^5.7.10"

tmp@^0.0.33:
version "0.0.33"
Expand Down

0 comments on commit 467d92f

Please sign in to comment.