Browse Source

Sensitive content settings

master
Igor Zhukov 5 years ago
parent
commit
a5c985293d
  1. 1
      README.md
  2. 18
      app/js/controllers.js
  3. 5
      app/js/lib/config.js
  4. 5
      app/js/locales/en-us.json
  5. 3
      app/partials/desktop/confirm_modal.html
  6. 7
      app/partials/desktop/settings_modal.html
  7. 9
      app/partials/mobile/settings_modal.html
  8. 3
      gulpfile.js
  9. 880
      package-lock.json
  10. 7
      package.json

1
README.md

@ -1,5 +1,4 @@
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) [![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
[![Stories in Ready](https://badge.waffle.io/zhukov/webogram.png?label=ready&title=Ready)](https://waffle.io/zhukov/webogram)
## [Webogram](https://web.telegram.org) — Telegram Web App ## [Webogram](https://web.telegram.org) — Telegram Web App

18
app/js/controllers.js

@ -4276,6 +4276,24 @@ angular.module('myApp.controllers', ['myApp.i18n'])
} }
}) })
$scope.contentSettings = {notReady: true}
var contentSettingsPromise = MtpApiManager.invokeApi('account.getContentSettings', {}).then(function (contentsResult) {
$scope.contentSettings = contentsResult
})
$scope.toggleContentSettings = function () {
if ($scope.contentSettings.pFlags &&
$scope.contentSettings.pFlags.sensitive_enabled) {
delete $scope.contentSettings.pFlags.sensitive_enabled
MtpApiManager.invokeApi('account.setContentSettings', {flags: 0})
} else {
return ErrorService.confirm({type: 'CONTENT_SETTINGS_SENSITIVE'}).then(function () {
$scope.contentSettings.pFlags.sensitive_enabled = true
MtpApiManager.invokeApi('account.setContentSettings', {flags: 1})
})
}
}
$scope.notify = {volume: 0.5} $scope.notify = {volume: 0.5}
$scope.send = {} $scope.send = {}

5
app/js/lib/config.js

File diff suppressed because one or more lines are too long

5
app/js/locales/en-us.json

@ -86,6 +86,7 @@
"settings_modal_password_email_pending": "Click the link in {email} to complete Two-Step Verification setup.", "settings_modal_password_email_pending": "Click the link in {email} to complete Two-Step Verification setup.",
"settings_modal_password_email_pending_cancel": "Abort", "settings_modal_password_email_pending_cancel": "Abort",
"settings_modal_password_email_pending_cancel_mobile": "Abort password", "settings_modal_password_email_pending_cancel_mobile": "Abort password",
"settings_modal_show_sensitive_content": "Show Sensitive Content",
"password_delete_title": "Turn password off", "password_delete_title": "Turn password off",
"password_change_title": "Two-Step Verification", "password_change_title": "Two-Step Verification",
@ -277,7 +278,9 @@
"confirm_modal_migrate_supergroup_md": "Please note that group members will need to update their Telegram apps to the latest version to see your supergroup.\n\nAre you sure you want to upgrade this group?", "confirm_modal_migrate_supergroup_md": "Please note that group members will need to update their Telegram apps to the latest version to see your supergroup.\n\nAre you sure you want to upgrade this group?",
"confirm_modal_bot_access_phone": "The bot will know your phone number. This can be useful for integration with other services.", "confirm_modal_bot_access_phone": "The bot will know your phone number. This can be useful for integration with other services.",
"confirm_modal_bot_access_geo": "This will send your current location to the bot.", "confirm_modal_bot_access_geo": "This will send your current location to the bot.",
"confirm_modal_bot_access_geo_inline": "This bot would like to know your location each time you send it a request. This can be used to provide location-specific results.", "confirm_modal_bot_access_geo_inline": "This bot would like to know your location each time you send it a request. This can be used to provide location-specific results.",
"confirm_modal_content_settings_sensitive_md": "**Disable filtering**\nIf you disable filtering, Telegram will display sensitive media in public channels on all your connected devices.",
"confirm_modal_content_settings_sensitive_submit": "Disable",
"confirm_modal_are_u_sure": "Are you sure?", "confirm_modal_are_u_sure": "Are you sure?",

3
app/partials/desktop/confirm_modal.html

@ -86,6 +86,8 @@
<div ng-switch-when="BOT_ACCESS_PHONE" my-i18n="confirm_modal_bot_access_phone"></div> <div ng-switch-when="BOT_ACCESS_PHONE" my-i18n="confirm_modal_bot_access_phone"></div>
<div ng-switch-when="BOT_ACCESS_GEO" my-i18n="confirm_modal_bot_access_geo"></div> <div ng-switch-when="BOT_ACCESS_GEO" my-i18n="confirm_modal_bot_access_geo"></div>
<div ng-switch-when="BOT_ACCESS_GEO_INLINE" my-i18n="confirm_modal_bot_access_geo_inline"></div> <div ng-switch-when="BOT_ACCESS_GEO_INLINE" my-i18n="confirm_modal_bot_access_geo_inline"></div>
<div ng-switch-when="CONTENT_SETTINGS_SENSITIVE" my-i18n="confirm_modal_content_settings_sensitive_md"></div>
@ -117,6 +119,7 @@
<span ng-switch-when="SHARE_CONTACT_PEER" my-i18n="confirm_modal_share_contact_submit"></span> <span ng-switch-when="SHARE_CONTACT_PEER" my-i18n="confirm_modal_share_contact_submit"></span>
<span ng-switch-when="EXT_SHARE_PEER" my-i18n="confirm_modal_share_file_submit"></span> <span ng-switch-when="EXT_SHARE_PEER" my-i18n="confirm_modal_share_file_submit"></span>
<span ng-switch-when="RESET_ACCOUNT" my-i18n="confirm_modal_reset_account_submit"></span> <span ng-switch-when="RESET_ACCOUNT" my-i18n="confirm_modal_reset_account_submit"></span>
<span ng-switch-when="CONTENT_SETTINGS_SENSITIVE" my-i18n="confirm_modal_content_settings_sensitive_submit"></span>
<span ng-switch-default my-i18n="modal_ok"></span> <span ng-switch-default my-i18n="modal_ok"></span>
</button> </button>
</div> </div>

7
app/partials/desktop/settings_modal.html

@ -131,6 +131,13 @@
<a ng-if="password._ == 'account.password'" class="md_modal_section_link" ng-click="changePassword({action: 'change'})" my-i18n="settings_modal_change_password"></a> <a ng-if="password._ == 'account.password'" class="md_modal_section_link" ng-click="changePassword({action: 'change'})" my-i18n="settings_modal_change_password"></a>
</div> </div>
<a class="md_modal_section_toggle_wrap settings_modal_content_settings_wrap tg_checkbox" ng-click="toggleContentSettings()" ng-class="contentSettings.pFlags.sensitive_enabled ? 'tg_checkbox_on' : ''" ng-show="contentSettings.pFlags.sensitive_can_change">
<span class="icon icon-checkbox-outer"><i class="icon-checkbox-inner"></i></span>
<span class="tg_checkbox_label" my-i18n="settings_modal_show_sensitive_content"></span>
</a>
<div class="md_modal_section_link_wrap"> <div class="md_modal_section_link_wrap">
<a class="md_modal_section_link" ng-click="showSessions()" my-i18n="settings_modal_active_sessions"></a> <a class="md_modal_section_link" ng-click="showSessions()" my-i18n="settings_modal_active_sessions"></a>
</div> </div>

9
app/partials/mobile/settings_modal.html

@ -122,7 +122,7 @@
</div> </div>
<div class="mobile_modal_action_wrap" ng-controller="AppLangSelectController"> <div class="mobile_modal_action_wrap clearfix" ng-controller="AppLangSelectController">
<div class="mobile_modal_select_wrap pull-right"> <div class="mobile_modal_select_wrap pull-right">
<select class="form-control" ng-change="localeSelect()" ng-model="form.locale"> <select class="form-control" ng-change="localeSelect()" ng-model="form.locale">
<option ng-repeat="locale in ::supportedLocales" value="{{locale}}" ng-bind="langNames[locale]" ng-selected="locale == curLocale"></option> <option ng-repeat="locale in ::supportedLocales" value="{{locale}}" ng-bind="langNames[locale]" ng-selected="locale == curLocale"></option>
@ -131,6 +131,13 @@
<span class="mobile_modal_action" my-i18n="settings_modal_language"></span> <span class="mobile_modal_action" my-i18n="settings_modal_language"></span>
</div> </div>
<div class="mobile_modal_action_wrap">
<a class="mobile_modal_action tg_checkbox clearfix" ng-click="toggleContentSettings()" ng-class="contentSettings.pFlags.sensitive_enabled ? 'tg_checkbox_on' : ''">
<span class="icon icon-checkbox-outer"><i class="icon-checkbox-inner"></i></span>
<span class="tg_checkbox_label" my-i18n="settings_modal_show_sensitive_content"></span>
</a>
</div>
<div class="mobile_modal_section" ng-if="profile.phone"> <div class="mobile_modal_section" ng-if="profile.phone">
<h4 class="mobile_modal_section_header" my-i18n="user_modal_phone"></h4> <h4 class="mobile_modal_section_header" my-i18n="user_modal_phone"></h4>
<div class="mobile_modal_section_value" ng-bind="profile.phone | phoneNumber"></div> <div class="mobile_modal_section_value" ng-bind="profile.phone | phoneNumber"></div>

3
gulpfile.js

@ -225,7 +225,6 @@ function writeServiceWorkerFile (rootDir, handleFetch, callback) {
var config = { var config = {
cacheId: packageJson.name, cacheId: packageJson.name,
handleFetch: handleFetch, handleFetch: handleFetch,
logger: $.util.log,
staticFileGlobs: fileGlobs, staticFileGlobs: fileGlobs,
stripPrefix: './' + rootDir + '/', stripPrefix: './' + rootDir + '/',
importScripts: ['js/lib/push_worker.js'], importScripts: ['js/lib/push_worker.js'],
@ -242,7 +241,7 @@ gulp.task('generate-service-worker', gulp.series('build', function (callback) {
gulp.task('add-appcache-manifest', gulp.series('build', function () { gulp.task('add-appcache-manifest', gulp.series('build', function () {
return gulp.src(fileGlobs) return gulp.src(fileGlobs)
.pipe($.manifest({ .pipe($.manifest3({
timestamp: false, timestamp: false,
hash: true, hash: true,
network: ['http://*', 'https://*', '*'], network: ['http://*', 'https://*', '*'],

880
package-lock.json generated

File diff suppressed because it is too large Load Diff

7
package.json

@ -46,15 +46,15 @@
"devDependencies": { "devDependencies": {
"del": "^4.1.1", "del": "^4.1.1",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-angular-templatecache": "^1.1.0", "gulp-angular-templatecache": "^3.0.0",
"gulp-concat": "^2.1.7", "gulp-concat": "^2.1.7",
"gulp-gh-pages": "^0.5.4", "gulp-gh-pages": "^0.5.4",
"gulp-grep-stream": "0.0.2", "gulp-grep-stream": "0.0.2",
"gulp-imagemin": "^5.0.3", "gulp-imagemin": "^5.0.3",
"gulp-less": "^4.0.1", "gulp-less": "^4.0.1",
"gulp-livereload": "^4.0.1", "gulp-livereload": "^4.0.1",
"gulp-load-plugins": "^1.5.0", "gulp-load-plugins": "^2.0.1",
"gulp-manifest": "0.1.1", "gulp-manifest3": "0.1.2",
"gulp-minify-css": "^0.3.12", "gulp-minify-css": "^0.3.12",
"gulp-minify-html": "^0.1.1", "gulp-minify-html": "^0.1.1",
"gulp-ng-annotate": "~0.5.2", "gulp-ng-annotate": "~0.5.2",
@ -63,7 +63,6 @@
"gulp-standard": "^7.0.1", "gulp-standard": "^7.0.1",
"gulp-uglify": "^1.0.2", "gulp-uglify": "^1.0.2",
"gulp-usemin": "^0.3.29", "gulp-usemin": "^0.3.29",
"gulp-util": "^3.0.7",
"gulp-zip": "^0.1.2", "gulp-zip": "^0.1.2",
"http": "0.0.0", "http": "0.0.0",
"jasmine-core": "^2.5.2", "jasmine-core": "^2.5.2",

Loading…
Cancel
Save