mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-23 11:56:00 +01:00
auto clear clipboard
This commit is contained in:
parent
fdb822f8b3
commit
940b7c655c
2
jslib
2
jslib
@ -1 +1 @@
|
||||
Subproject commit 9a4611ec5a650362abc7f5616fd7006f950c5b3d
|
||||
Subproject commit b9267c521ddffce35932a0cc2e9726d30b80c60d
|
@ -30,6 +30,14 @@
|
||||
{{'options' | i18n}}
|
||||
</div>
|
||||
<div class="box-content box-content-padded">
|
||||
<div class="form-group">
|
||||
<label for="clearClipboard">{{'clearClipboard' | i18n}}</label>
|
||||
<select id="clearClipboard" name="ClearClipboard" [(ngModel)]="clearClipboard"
|
||||
(change)="saveClearClipboard()">
|
||||
<option *ngFor="let o of clearClipboardOptions" [ngValue]="o.value">{{o.name}}</option>
|
||||
</select>
|
||||
<small class="help-block">{{'clearClipboardDesc' | i18n}}</small>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="checkbox">
|
||||
<label for="disableFavicons">
|
||||
|
@ -42,6 +42,8 @@ export class SettingsComponent implements OnInit {
|
||||
localeOptions: any[];
|
||||
theme: string;
|
||||
themeOptions: any[];
|
||||
clearClipboard: number;
|
||||
clearClipboardOptions: any[];
|
||||
|
||||
constructor(private analytics: Angulartics2, private toasterService: ToasterService,
|
||||
private i18nService: I18nService, private platformUtilsService: PlatformUtilsService,
|
||||
@ -77,6 +79,16 @@ export class SettingsComponent implements OnInit {
|
||||
{ name: i18nService.t('dark'), value: 'dark' },
|
||||
{ name: 'Nord', value: 'nord' },
|
||||
];
|
||||
|
||||
this.clearClipboardOptions = [
|
||||
{ name: i18nService.t('never'), value: null },
|
||||
{ name: i18nService.t('tenSeconds'), value: 10 },
|
||||
{ name: i18nService.t('twentySeconds'), value: 20 },
|
||||
{ name: i18nService.t('thirtySeconds'), value: 30 },
|
||||
{ name: i18nService.t('oneMinute'), value: 60 },
|
||||
{ name: i18nService.t('twoMinutes'), value: 120 },
|
||||
{ name: i18nService.t('fiveMinutes'), value: 300 },
|
||||
];
|
||||
}
|
||||
|
||||
async ngOnInit() {
|
||||
@ -91,6 +103,7 @@ export class SettingsComponent implements OnInit {
|
||||
this.startToTray = await this.storageService.get<boolean>(ElectronConstants.enableStartToTrayKey);
|
||||
this.locale = await this.storageService.get<string>(ConstantsService.localeKey);
|
||||
this.theme = await this.storageService.get<string>(ConstantsService.themeKey);
|
||||
this.clearClipboard = await this.storageService.get<number>(ConstantsService.clearClipboardKey);
|
||||
}
|
||||
|
||||
async saveLockOption() {
|
||||
@ -184,6 +197,13 @@ export class SettingsComponent implements OnInit {
|
||||
window.setTimeout(() => window.location.reload(), 200);
|
||||
}
|
||||
|
||||
async saveClearClipboard() {
|
||||
await this.storageService.save(ConstantsService.clearClipboardKey, this.clearClipboard);
|
||||
this.analytics.eventTrack.next({
|
||||
action: 'Set Clear Clipboard ' + (this.clearClipboard == null ? 'Disabled' : this.clearClipboard),
|
||||
});
|
||||
}
|
||||
|
||||
private callAnalytics(name: string, enabled: boolean) {
|
||||
const status = enabled ? 'Enabled' : 'Disabled';
|
||||
this.analytics.eventTrack.next({ action: `${status} ${name}` });
|
||||
|
@ -44,6 +44,7 @@ import { SearchService } from 'jslib/abstractions/search.service';
|
||||
import { SettingsService } from 'jslib/abstractions/settings.service';
|
||||
import { StorageService } from 'jslib/abstractions/storage.service';
|
||||
import { SyncService } from 'jslib/abstractions/sync.service';
|
||||
import { SystemService } from 'jslib/abstractions/system.service';
|
||||
import { TokenService } from 'jslib/abstractions/token.service';
|
||||
import { UserService } from 'jslib/abstractions/user.service';
|
||||
|
||||
@ -91,7 +92,7 @@ export class AppComponent implements OnInit {
|
||||
private cryptoService: CryptoService, private componentFactoryResolver: ComponentFactoryResolver,
|
||||
private messagingService: MessagingService, private collectionService: CollectionService,
|
||||
private searchService: SearchService, private notificationsService: NotificationsService,
|
||||
private platformUtilsService: PlatformUtilsService) { }
|
||||
private platformUtilsService: PlatformUtilsService, private systemService: SystemService) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.ngZone.runOutsideAngular(() => {
|
||||
@ -114,12 +115,12 @@ export class AppComponent implements OnInit {
|
||||
case 'unlocked':
|
||||
this.notificationsService.updateConnection();
|
||||
this.updateAppMenu();
|
||||
this.lockService.cancelLockReload();
|
||||
this.systemService.cancelProcessReload();
|
||||
break;
|
||||
case 'loggedOut':
|
||||
this.notificationsService.updateConnection();
|
||||
this.updateAppMenu();
|
||||
this.lockService.startLockReload();
|
||||
this.systemService.startProcessReload();
|
||||
break;
|
||||
case 'logout':
|
||||
this.logOut(!!message.expired);
|
||||
@ -131,7 +132,7 @@ export class AppComponent implements OnInit {
|
||||
this.router.navigate(['lock']);
|
||||
this.notificationsService.updateConnection();
|
||||
this.updateAppMenu();
|
||||
this.lockService.startLockReload();
|
||||
this.systemService.startProcessReload();
|
||||
break;
|
||||
case 'reloadProcess':
|
||||
window.location.reload(true);
|
||||
@ -171,6 +172,9 @@ export class AppComponent implements OnInit {
|
||||
properties: { label: message.label },
|
||||
});
|
||||
break;
|
||||
case 'copiedToClipboard':
|
||||
this.systemService.clearClipboard(message.clipboardValue, message.clearMs);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
|
@ -42,6 +42,7 @@ import { SearchService } from 'jslib/services/search.service';
|
||||
import { SettingsService } from 'jslib/services/settings.service';
|
||||
import { StateService } from 'jslib/services/state.service';
|
||||
import { SyncService } from 'jslib/services/sync.service';
|
||||
import { SystemService } from 'jslib/services/system.service';
|
||||
import { TokenService } from 'jslib/services/token.service';
|
||||
import { TotpService } from 'jslib/services/totp.service';
|
||||
import { UserService } from 'jslib/services/user.service';
|
||||
@ -72,6 +73,7 @@ import { SettingsService as SettingsServiceAbstraction } from 'jslib/abstraction
|
||||
import { StateService as StateServiceAbstraction } from 'jslib/abstractions/state.service';
|
||||
import { StorageService as StorageServiceAbstraction } from 'jslib/abstractions/storage.service';
|
||||
import { SyncService as SyncServiceAbstraction } from 'jslib/abstractions/sync.service';
|
||||
import { SystemService as SystemServiceAbstraction } from 'jslib/abstractions/system.service';
|
||||
import { TokenService as TokenServiceAbstraction } from 'jslib/abstractions/token.service';
|
||||
import { TotpService as TotpServiceAbstraction } from 'jslib/abstractions/totp.service';
|
||||
import { UserService as UserServiceAbstraction } from 'jslib/abstractions/user.service';
|
||||
@ -115,6 +117,7 @@ const auditService = new AuditService(cryptoFunctionService, apiService);
|
||||
const notificationsService = new NotificationsService(userService, syncService, appIdService,
|
||||
apiService, lockService, async () => messagingService.send('logout', { expired: true }));
|
||||
const environmentService = new EnvironmentService(apiService, storageService, notificationsService);
|
||||
const systemService = new SystemService(storageService, lockService, messagingService, platformUtilsService, null);
|
||||
|
||||
const analytics = new Analytics(window, () => isDev(), platformUtilsService, storageService, appIdService);
|
||||
containerService.attachToGlobal(window);
|
||||
@ -191,6 +194,7 @@ export function initFactory(): Function {
|
||||
{ provide: ExportServiceAbstraction, useValue: exportService },
|
||||
{ provide: SearchServiceAbstraction, useValue: searchService },
|
||||
{ provide: NotificationsServiceAbstraction, useValue: notificationsService },
|
||||
{ provide: SystemServiceAbstraction, useValue: systemService },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: initFactory,
|
||||
|
@ -761,9 +761,21 @@
|
||||
"immediately": {
|
||||
"message": "Immediately"
|
||||
},
|
||||
"tenSeconds": {
|
||||
"message": "10 seconds"
|
||||
},
|
||||
"twentySeconds": {
|
||||
"message": "20 seconds"
|
||||
},
|
||||
"thirtySeconds": {
|
||||
"message": "30 seconds"
|
||||
},
|
||||
"oneMinute": {
|
||||
"message": "1 minute"
|
||||
},
|
||||
"twoMinutes": {
|
||||
"message": "2 minutes"
|
||||
},
|
||||
"fiveMinutes": {
|
||||
"message": "5 minutes"
|
||||
},
|
||||
@ -797,6 +809,14 @@
|
||||
"security": {
|
||||
"message": "Security"
|
||||
},
|
||||
"clearClipboard": {
|
||||
"message": "Clear Clipboard",
|
||||
"description": "Clipboard is the operating system thing where you copy/paste data to on your device."
|
||||
},
|
||||
"clearClipboardDesc": {
|
||||
"message": "Automatically clear copied values from your clipboard.",
|
||||
"description": "Clipboard is the operating system thing where you copy/paste data to on your device."
|
||||
},
|
||||
"disableFavicon": {
|
||||
"message": "Disable Website Icons"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user