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

Commit

Permalink
Fixes formatting for YT on shields page
Browse files Browse the repository at this point in the history
Resolves #12271

Auditors:

Test Plan:
  • Loading branch information
NejcZdovc committed Mar 14, 2018
1 parent 9d5977a commit 6a0d923
Show file tree
Hide file tree
Showing 5 changed files with 47 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 @@ -101,10 +101,11 @@ class LedgerTable extends ImmutableComponent {
return synopsis.get('pinPercentage')
}

banSite (hostPattern) {
banSite (hostPattern, siteName) {
const confMsg = locale.translation('banSiteConfirmation')
if (window.confirm(confMsg)) {
aboutActions.changeSiteSetting(hostPattern, 'ledgerPaymentsShown', false)
aboutActions.changeSiteSetting(hostPattern, 'siteName', siteName)
}
}

Expand Down Expand Up @@ -258,7 +259,7 @@ class LedgerTable extends ImmutableComponent {
styles.actionIcons__icon,
styles.actionIcons__icon_remove
)}
onClick={this.banSite.bind(this, this.getHostPattern(synopsis))}
onClick={this.banSite.bind(this, this.getHostPattern(synopsis), siteName)}
/>
</div>,
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
23 changes: 22 additions & 1 deletion app/sessionStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -825,8 +825,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.21.9') < 1
} catch (e) {}

if (runWidevineCleanup) {
const fs = require('fs-extra')
Expand All @@ -838,6 +842,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 @@ -510,6 +510,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 @@ -528,14 +529,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 6a0d923

Please sign in to comment.