From 3321fa91e42154d804650e67cd150c851b4ec0a0 Mon Sep 17 00:00:00 2001 From: ChunkyProgrammer <78101139+ChunkyProgrammer@users.noreply.github.com> Date: Tue, 21 Jun 2022 02:14:15 -0400 Subject: [PATCH] Add Parental Controls (#1456) * start to implement some parental controls * Hide share + Hide Unsubscribe * Hide live streams * fix hide live streams * Add "parental-control-settings" * Implement Hide Live Streams & Hide "Age Restricted" * Hide live streams from Subscriptions + fix hide live streams from search * enable safe search on showFamilyFriendlyOnly * Move some settings from parental control to distraction free * fix channel loading * make parental control settings collapsible * fix lint * dont show age restricted on videos that are loading * improve hide live videos * code refactor * grammar * nvm im dumb * use named placeholder for age restricted message * improve readability * change Hide Description to Hide Video Description * update translated strings * fix age restricted component Co-authored-by: Preston Co-authored-by: peepopoggers <72892531+peepopoggers@users.noreply.github.com> --- .../distraction-settings.js | 18 ++- .../distraction-settings.vue | 24 ++++ .../ft-age-restricted/ft-age-restricted.js | 22 ++++ .../ft-age-restricted/ft-age-restricted.sass | 14 +++ .../ft-age-restricted/ft-age-restricted.vue | 15 +++ .../ft-list-lazy-wrapper.js | 5 + .../ft-list-lazy-wrapper.vue | 1 + .../components/ft-list-video/ft-list-video.js | 118 ++++++++++-------- .../parental-control-settings.js | 36 ++++++ .../parental-control-settings.sass | 1 + .../parental-control-settings.vue | 37 ++++++ .../components/playlist-info/playlist-info.js | 4 + .../playlist-info/playlist-info.vue | 1 + src/renderer/components/top-nav/top-nav.js | 4 + src/renderer/components/top-nav/top-nav.vue | 4 + .../watch-video-info/watch-video-info.js | 8 ++ .../watch-video-info/watch-video-info.vue | 2 + src/renderer/store/modules/settings.js | 7 ++ src/renderer/views/Channel/Channel.js | 15 ++- src/renderer/views/Channel/Channel.vue | 10 +- src/renderer/views/Search/Search.js | 10 ++ src/renderer/views/Settings/Settings.js | 4 +- src/renderer/views/Settings/Settings.vue | 2 + .../views/Subscriptions/Subscriptions.js | 10 +- src/renderer/views/Watch/Watch.js | 16 ++- src/renderer/views/Watch/Watch.sass | 6 + src/renderer/views/Watch/Watch.vue | 24 +++- static/locales/en-US.yaml | 15 +++ 28 files changed, 368 insertions(+), 65 deletions(-) create mode 100644 src/renderer/components/ft-age-restricted/ft-age-restricted.js create mode 100644 src/renderer/components/ft-age-restricted/ft-age-restricted.sass create mode 100644 src/renderer/components/ft-age-restricted/ft-age-restricted.vue create mode 100644 src/renderer/components/parental-control-settings/parental-control-settings.js create mode 100644 src/renderer/components/parental-control-settings/parental-control-settings.sass create mode 100644 src/renderer/components/parental-control-settings/parental-control-settings.vue diff --git a/src/renderer/components/distraction-settings/distraction-settings.js b/src/renderer/components/distraction-settings/distraction-settings.js index 790368b4..891cf702 100644 --- a/src/renderer/components/distraction-settings/distraction-settings.js +++ b/src/renderer/components/distraction-settings/distraction-settings.js @@ -45,6 +45,18 @@ export default Vue.extend({ }, hideActiveSubscriptions: function () { return this.$store.getters.getHideActiveSubscriptions + }, + hideVideoDescription: function () { + return this.$store.getters.getHideVideoDescription + }, + hideComments: function () { + return this.$store.getters.getHideComments + }, + hideLiveStreams: function() { + return this.$store.getters.getHideLiveStreams + }, + hideSharingActions: function() { + return this.$store.getters.getHideSharingActions } }, methods: { @@ -68,7 +80,11 @@ export default Vue.extend({ 'updateHideLiveChat', 'updateHideActiveSubscriptions', 'updatePlayNextVideo', - 'updateDefaultTheatreMode' + 'updateDefaultTheatreMode', + 'updateHideVideoDescription', + 'updateHideComments', + 'updateHideLiveStreams', + 'updateHideSharingActions' ]) } }) diff --git a/src/renderer/components/distraction-settings/distraction-settings.vue b/src/renderer/components/distraction-settings/distraction-settings.vue index aef21062..4c59582d 100644 --- a/src/renderer/components/distraction-settings/distraction-settings.vue +++ b/src/renderer/components/distraction-settings/distraction-settings.vue @@ -38,6 +38,18 @@ :default-value="hideActiveSubscriptions" @change="updateHideActiveSubscriptions" /> + +
+ +

diff --git a/src/renderer/components/ft-age-restricted/ft-age-restricted.js b/src/renderer/components/ft-age-restricted/ft-age-restricted.js new file mode 100644 index 00000000..5769012b --- /dev/null +++ b/src/renderer/components/ft-age-restricted/ft-age-restricted.js @@ -0,0 +1,22 @@ +import Vue from 'vue' + +export default Vue.extend({ + name: 'FtAgeRestricted', + props: { + contentTypeString: { + type: String, + required: true + } + }, + computed: { + emoji: function () { + const emojis = ['đŸ˜ĩ', 'đŸ˜Ļ', '🙁', '☚ī¸', 'đŸ˜Ļ', 'đŸ¤Ģ', '😕'] + return emojis[Math.floor(Math.random() * emojis.length)] + }, + + restrictedMessage: function () { + const contentType = this.$t('Age Restricted.Type.' + this.contentTypeString) + return this.$t('Age Restricted.This $contentType is age restricted').replace('$contentType', contentType) + } + } +}) diff --git a/src/renderer/components/ft-age-restricted/ft-age-restricted.sass b/src/renderer/components/ft-age-restricted/ft-age-restricted.sass new file mode 100644 index 00000000..58d44107 --- /dev/null +++ b/src/renderer/components/ft-age-restricted/ft-age-restricted.sass @@ -0,0 +1,14 @@ +.ft-age-restricted + color: var(--primary-text-color) + h2 + width: 100% + text-align: center + background-color: var(--card-bg-color) + padding: 10px 0 + .frown + width: 100% + text-align: center + background-color: var(--card-bg-color) + font-size: 10em + padding: 20px 0 + height: 100% diff --git a/src/renderer/components/ft-age-restricted/ft-age-restricted.vue b/src/renderer/components/ft-age-restricted/ft-age-restricted.vue new file mode 100644 index 00000000..abc2eac8 --- /dev/null +++ b/src/renderer/components/ft-age-restricted/ft-age-restricted.vue @@ -0,0 +1,15 @@ + + +