Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
Session check
Browse files Browse the repository at this point in the history
  • Loading branch information
NejcZdovc committed Dec 18, 2017
1 parent 9ad2f80 commit 67dd8fe
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
23 changes: 22 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -830,8 +830,12 @@ module.exports.runPreMigrations = (data) => {
if (data.lastAppVersion) {
// Force WidevineCdm to be upgraded when last app version <= 0.18.25
let runWidevineCleanup = false
let formatPublishers = false

try { runWidevineCleanup = compareVersions(data.lastAppVersion, '0.18.25') < 1 } catch (e) {}
try {
runWidevineCleanup = compareVersions(data.lastAppVersion, '0.18.25') < 1
formatPublishers = compareVersions(data.lastAppVersion, '0.22.0') < 1
} catch (e) {}

if (runWidevineCleanup) {
const fs = require('fs-extra')
Expand All @@ -842,6 +846,23 @@ module.exports.runPreMigrations = (data) => {
}
})
}

if (formatPublishers) {
const publishers = data.ledger.synopsis.publishers

if (publishers && Object.keys(publishers).length > 0) {
Object.entries(publishers).forEach((item) => {
const publisherKey = item[0]
const publisher = item[1]
const siteKey = `https?://${publisherKey}`
if (data.siteSettings[siteKey] == null || publisher.faviconName == null) {
return
}

data.siteSettings[siteKey].siteName = publisher.faviconName
})
}
}
}

return data
Expand Down
33 changes: 17 additions & 16 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,19 +186,19 @@ AppStore
},
info: {
addresses: {
BAT: string,
BTC: string,
CARD_ID: string,
ETH: string,
BAT: string,
BTC: string,
CARD_ID: string,
ETH: string,
LTC: string
},
balance: number, // confirmed balance in BAT.toFixed(2)
bravery: {
days: number,
days: number,
fee: {
amount: number,
currency: string
},
},
setting: string
},
converted: string,
Expand All @@ -210,9 +210,9 @@ AppStore
paymentId: string,
probi: number,
rates:{
BTC: string,
ETH: number,
EUR: number,
BTC: string,
ETH: number,
EUR: number,
USD: number
},
reconcileFrequency: number // duration between each reconciliation in days
Expand Down Expand Up @@ -265,7 +265,7 @@ AppStore
options: {
persist: boolean,
style: string
}
}
},
panel: {
optInMarkup: {
Expand All @@ -288,7 +288,7 @@ AppStore
options: {
persist: boolean,
style: string
}
}
},
panel: {
disclaimer: string,
Expand All @@ -313,7 +313,7 @@ AppStore
options: {
persist: boolean,
style: string
}
}
},
panel: {
disclaimer: string,
Expand Down Expand Up @@ -348,7 +348,7 @@ AppStore
options: {
exclude: boolean,
verified: boolean,
verifiedTimestamp: number, // timestamp of the last change
verifiedTimestamp: number, // timestamp of the last change
stickyP: boolean
},
pinPercentage: number,
Expand Down Expand Up @@ -509,6 +509,7 @@ AppStore
siteSettings: {
[hostPattern]: {
adControl: string, // (showBraveAds | blockAds | allowAdsAndTracking)
autoplay: boolean,
cookieControl: string, // (block3rdPartyCookie | allowAllCookies | blockAllCookies)
fingerprintingProtection: string, // (block3rdPartyFingerprinting | allowAllFingerprinting | blockAllFingerprinting)
flash: (number|boolean), // approval expiration time if allowed, false if never allow
Expand All @@ -527,14 +528,14 @@ AppStore
openExternalPermission: boolean,
pointerLockPermission: boolean,
protocolRegistrationPermission: boolean,
skipSync: boolean, // Set for objects FETCHed by sync
runInsecureContent: boolean, // allow active mixed content
safeBrowsing: boolean,
siteName: string, // display name of the publisher
skipSync: boolean, // Set for objects FETCHed by sync
savePasswords: boolean, // only false or undefined/null
shieldsUp: boolean,
widevine: (number|boolean), // false = block widevine, 0 = allow once, 1 = allow always
zoomLevel: number,
autoplay: boolean,
zoomLevel: number
}
},
defaultSiteSettingsListImported: boolean,
Expand Down

0 comments on commit 67dd8fe

Please sign in to comment.