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

Commit

Permalink
Merge pull request #12299 from NejcZdovc/hotfix/#12271-format
Browse files Browse the repository at this point in the history
Fixes formatting for YT on shields page
  • Loading branch information
NejcZdovc committed Apr 11, 2018
1 parent cbd026e commit 5a002f6
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 10 deletions.
12 changes: 9 additions & 3 deletions app/renderer/components/preferences/payment/deletedSites.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,22 @@ class DeletedSitesContent extends ImmutableComponent {
return <div id='sitePermissionsPage'>
<ul className={css(styles.sitePermissions__list)}>
{
this.props.sites.map(hostPattern => {
this.props.sites.map(data => {
let siteName = (data.hostPattern || '').replace('?://', '://')

if (data.siteName) {
siteName = data.siteName
}

return <div className={css(styles.sitePermissions__list__item)}>
<BrowserButton
iconOnly
iconClass={globalStyles.appIcons.remove}
size='1rem'
custom={styles.sitePermissions__list__item__button}
onClick={this.deletePermission.bind(this, permissionName, hostPattern)}
onClick={this.deletePermission.bind(this, permissionName, data.hostPattern)}
/>
<span>{hostPattern}</span>
<span>{siteName}</span>
</div>
})
}
Expand Down
5 changes: 3 additions & 2 deletions app/renderer/components/preferences/payment/ledgerTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ class LedgerTable extends ImmutableComponent {
return synopsis.get('pinPercentage')
}

banSite (hostPattern) {
banSite (hostPattern, siteName) {
aboutActions.changeSiteSetting(hostPattern, 'ledgerPaymentsShown', false)
aboutActions.changeSiteSetting(hostPattern, 'siteName', siteName)
}

togglePinSite (hostPattern, pinned, percentage) {
Expand Down Expand Up @@ -245,7 +246,7 @@ class LedgerTable extends ImmutableComponent {
data-test-pinned={pinned}
/>
<span className={css(styles.mainIcon, styles.removeIcon)}
onClick={this.banSite.bind(this, this.getHostPattern(synopsis))}
onClick={this.banSite.bind(this, this.getHostPattern(synopsis), siteName)}
/>
</span>,
value: ''
Expand Down
10 changes: 9 additions & 1 deletion app/renderer/components/preferences/paymentsTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,15 @@ class PaymentsTab extends ImmutableComponent {
}

if (['boolean', 'number'].includes(typeof granted)) {
sites.push(hostPattern)
let siteName = null
if (value.has('siteName')) {
siteName = value.get('siteName')
}

sites.push({
siteName,
hostPattern
})
}
})

Expand Down
24 changes: 23 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,12 @@ module.exports.runPreMigrations = (data) => {

// Force WidevineCdm to be upgraded when last app version <= 0.18.25
let runWidevineCleanup = false
try { runWidevineCleanup = compareVersions(data.lastAppVersion, '0.18.25') < 1 } catch (e) {}
let formatPublishers = false

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

if (runWidevineCleanup) {
const fs = require('fs-extra')
Expand All @@ -844,6 +849,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
})
}
}

// Bookmark cache was generated wrongly on and before 0.20.25 from 0.19.x upgrades
let runCacheClean = false
try { runCacheClean = compareVersions(data.lastAppVersion, '0.20.25') < 1 } catch (e) {}
Expand Down
7 changes: 4 additions & 3 deletions docs/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,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 @@ -530,14 +531,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 5a002f6

Please sign in to comment.