mirror of
https://github.com/bitwarden/browser
synced 2025-12-13 23:03:32 +00:00
remove extraneous code
This commit is contained in:
@@ -23,7 +23,6 @@ export function extensionRefreshSwap(
|
|||||||
defaultComponent,
|
defaultComponent,
|
||||||
refreshedComponent,
|
refreshedComponent,
|
||||||
async () => {
|
async () => {
|
||||||
return true;
|
|
||||||
const configService = inject(ConfigService);
|
const configService = inject(ConfigService);
|
||||||
return configService.getFeatureFlag(FeatureFlag.ExtensionRefresh);
|
return configService.getFeatureFlag(FeatureFlag.ExtensionRefresh);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { SendFileDownloadDataResponse } from "../models/response/send-file-downl
|
|||||||
import { SendFileUploadDataResponse } from "../models/response/send-file-upload-data.response";
|
import { SendFileUploadDataResponse } from "../models/response/send-file-upload-data.response";
|
||||||
import { SendResponse } from "../models/response/send.response";
|
import { SendResponse } from "../models/response/send.response";
|
||||||
import { SendAccessView } from "../models/view/send-access.view";
|
import { SendAccessView } from "../models/view/send-access.view";
|
||||||
|
import { SendView } from "../models/view/send.view";
|
||||||
|
|
||||||
export abstract class SendApiService {
|
export abstract class SendApiService {
|
||||||
getSend: (id: string) => Promise<SendResponse>;
|
getSend: (id: string) => Promise<SendResponse>;
|
||||||
@@ -36,5 +37,5 @@ export abstract class SendApiService {
|
|||||||
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
renewSendFileUploadUrl: (sendId: string, fileId: string) => Promise<SendFileUploadDataResponse>;
|
||||||
removePassword: (id: string) => Promise<any>;
|
removePassword: (id: string) => Promise<any>;
|
||||||
delete: (id: string) => Promise<any>;
|
delete: (id: string) => Promise<any>;
|
||||||
save: (sendData: [Send, EncArrayBuffer]) => Promise<void>;
|
save: (sendData: [Send, EncArrayBuffer]) => Promise<SendView>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export class SendApiService implements SendApiServiceAbstraction {
|
|||||||
return this.apiService.send("DELETE", "/sends/" + id, null, true, false);
|
return this.apiService.send("DELETE", "/sends/" + id, null, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async save(sendData: [Send, EncArrayBuffer]): Promise<void> {
|
async save(sendData: [Send, EncArrayBuffer]): Promise<any> {
|
||||||
const response = await this.upload(sendData);
|
const response = await this.upload(sendData);
|
||||||
|
|
||||||
const data = new SendData(response);
|
const data = new SendData(response);
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ export abstract class SendFormService {
|
|||||||
send: SendView,
|
send: SendView,
|
||||||
file: File | ArrayBuffer,
|
file: File | ArrayBuffer,
|
||||||
config: SendFormConfig,
|
config: SendFormConfig,
|
||||||
): Promise<void>;
|
): Promise<SendView>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<bit-section [formGroup]="additionalOptionsForm">
|
|
||||||
<bit-section-header>
|
|
||||||
<h2 bitTypography="h5">{{ "additionalOptions" | i18n }}</h2>
|
|
||||||
</bit-section-header>
|
|
||||||
|
|
||||||
<bit-card>
|
|
||||||
<bit-form-field>
|
|
||||||
<bit-label>{{ "limitSendViews" | i18n }}</bit-label>
|
|
||||||
<input bitInput type="number" formControlName="maxAccessCount" min="1" />
|
|
||||||
<bit-hint>{{ "limitSendViewsHint" | i18n }}</bit-hint>
|
|
||||||
<!-- <bit-hint>{{ "limitSendViewsHintWithCount" | i18n: 4 }}</bit-hint> -->
|
|
||||||
</bit-form-field>
|
|
||||||
<!-- TODO: Add information of current access count as bitHint -->
|
|
||||||
<bit-form-field>
|
|
||||||
<bit-label>{{ "currentAccessCount" | i18n }}</bit-label>
|
|
||||||
<input bitInput type="text" formControlName="accessCount" readonly />
|
|
||||||
</bit-form-field>
|
|
||||||
|
|
||||||
<bit-form-field>
|
|
||||||
<bit-label *ngIf="!hasPassword">{{ "password" | i18n }}</bit-label>
|
|
||||||
<bit-label *ngIf="hasPassword">{{ "newPassword" | i18n }}</bit-label>
|
|
||||||
|
|
||||||
<input bitInput type="password" formControlName="password" />
|
|
||||||
<button type="button" bitIconButton bitSuffix bitPasswordInputToggle></button>
|
|
||||||
<button type="button" bitIconButton="bwi-refresh" bitSuffix></button>
|
|
||||||
<bit-hint>{{ "sendPasswordDesc" | i18n }}</bit-hint>
|
|
||||||
</bit-form-field>
|
|
||||||
|
|
||||||
<bit-form-control>
|
|
||||||
<input bitCheckbox type="checkbox" formControlName="hideEmail" />
|
|
||||||
<bit-label>{{ "hideEmail" | i18n }}</bit-label>
|
|
||||||
</bit-form-control>
|
|
||||||
|
|
||||||
<bit-form-field>
|
|
||||||
<bit-label>{{ "notes" | i18n }}</bit-label>
|
|
||||||
<textarea bitInput formControlName="notes"></textarea>
|
|
||||||
</bit-form-field>
|
|
||||||
</bit-card>
|
|
||||||
</bit-section>
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
import { CommonModule } from "@angular/common";
|
|
||||||
import { Component, Input, OnInit } from "@angular/core";
|
|
||||||
import { takeUntilDestroyed } from "@angular/core/rxjs-interop";
|
|
||||||
import { FormBuilder, ReactiveFormsModule } from "@angular/forms";
|
|
||||||
|
|
||||||
import { JslibModule } from "@bitwarden/angular/jslib.module";
|
|
||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
|
||||||
import {
|
|
||||||
CardComponent,
|
|
||||||
CheckboxModule,
|
|
||||||
FormFieldModule,
|
|
||||||
IconButtonModule,
|
|
||||||
SectionComponent,
|
|
||||||
SectionHeaderComponent,
|
|
||||||
TypographyModule,
|
|
||||||
} from "@bitwarden/components";
|
|
||||||
|
|
||||||
import { SendFormConfig } from "../../abstractions/send-form-config.service";
|
|
||||||
import { SendFormContainer } from "../../send-form-container";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: "tools-send-options-section",
|
|
||||||
templateUrl: "./options-section.component.html",
|
|
||||||
standalone: true,
|
|
||||||
imports: [
|
|
||||||
SectionComponent,
|
|
||||||
SectionHeaderComponent,
|
|
||||||
TypographyModule,
|
|
||||||
JslibModule,
|
|
||||||
CardComponent,
|
|
||||||
FormFieldModule,
|
|
||||||
ReactiveFormsModule,
|
|
||||||
IconButtonModule,
|
|
||||||
CheckboxModule,
|
|
||||||
CommonModule,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
export class AdditionalOptionsSectionComponent implements OnInit {
|
|
||||||
@Input({ required: true })
|
|
||||||
config: SendFormConfig;
|
|
||||||
|
|
||||||
@Input()
|
|
||||||
originalSendView: SendView;
|
|
||||||
|
|
||||||
additionalOptionsForm = this.formBuilder.group({
|
|
||||||
maxAccessCount: [null as number],
|
|
||||||
accessCount: [null as number],
|
|
||||||
notes: [null as string],
|
|
||||||
password: [null as string],
|
|
||||||
hideEmail: [false as boolean],
|
|
||||||
});
|
|
||||||
|
|
||||||
get hasPassword(): boolean {
|
|
||||||
return (
|
|
||||||
this.additionalOptionsForm.value.password !== null &&
|
|
||||||
this.additionalOptionsForm.value.password !== ""
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private sendFormContainer: SendFormContainer,
|
|
||||||
private formBuilder: FormBuilder,
|
|
||||||
) {
|
|
||||||
this.sendFormContainer.registerChildForm("additionalOptions", this.additionalOptionsForm);
|
|
||||||
|
|
||||||
this.additionalOptionsForm.valueChanges.pipe(takeUntilDestroyed()).subscribe((value) => {
|
|
||||||
this.sendFormContainer.patchSend((send) => {
|
|
||||||
Object.assign(send, {
|
|
||||||
maxAccessCount: value.maxAccessCount,
|
|
||||||
accessCount: value.accessCount,
|
|
||||||
password: value.password,
|
|
||||||
hideEmail: value.hideEmail,
|
|
||||||
notes: value.notes,
|
|
||||||
});
|
|
||||||
return send;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
if (this.sendFormContainer.originalSendView) {
|
|
||||||
this.additionalOptionsForm.patchValue({
|
|
||||||
maxAccessCount: this.sendFormContainer.originalSendView.maxAccessCount,
|
|
||||||
accessCount: this.sendFormContainer.originalSendView.accessCount,
|
|
||||||
password: this.sendFormContainer.originalSendView.password,
|
|
||||||
hideEmail: this.sendFormContainer.originalSendView.hideEmail,
|
|
||||||
notes: this.sendFormContainer.originalSendView.notes,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,9 +6,5 @@
|
|||||||
[config]="config"
|
[config]="config"
|
||||||
[originalSendView]="originalSendView"
|
[originalSendView]="originalSendView"
|
||||||
></tools-send-text-details>
|
></tools-send-text-details>
|
||||||
<tools-send-options-section
|
|
||||||
[config]="config"
|
|
||||||
[originalSendView]="originalSendView"
|
|
||||||
></tools-send-options-section>
|
|
||||||
</ng-container>
|
</ng-container>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import { SendFormConfig } from "../abstractions/send-form-config.service";
|
|||||||
import { SendFormService } from "../abstractions/send-form.service";
|
import { SendFormService } from "../abstractions/send-form.service";
|
||||||
import { SendForm, SendFormContainer } from "../send-form-container";
|
import { SendForm, SendFormContainer } from "../send-form-container";
|
||||||
|
|
||||||
import { AdditionalOptionsSectionComponent } from "./options/options-section.component";
|
|
||||||
import { SendTextDetailsComponent } from "./send-details/send-text-details.component";
|
import { SendTextDetailsComponent } from "./send-details/send-text-details.component";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -58,7 +57,6 @@ import { SendTextDetailsComponent } from "./send-details/send-text-details.compo
|
|||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
SelectModule,
|
SelectModule,
|
||||||
NgIf,
|
NgIf,
|
||||||
AdditionalOptionsSectionComponent,
|
|
||||||
SendTextDetailsComponent,
|
SendTextDetailsComponent,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
import { SendView } from "@bitwarden/common/tools/send/models/view/send.view";
|
||||||
|
|
||||||
import { SendFormConfig } from "./abstractions/send-form-config.service";
|
import { SendFormConfig } from "./abstractions/send-form-config.service";
|
||||||
import { AdditionalOptionsSectionComponent } from "./components/options/options-section.component";
|
|
||||||
import { SendTextDetailsComponent } from "./components/send-details/send-text-details.component";
|
import { SendTextDetailsComponent } from "./components/send-details/send-text-details.component";
|
||||||
/**
|
/**
|
||||||
* The complete form for a send. Includes all the sub-forms from their respective section components.
|
* The complete form for a send. Includes all the sub-forms from their respective section components.
|
||||||
@@ -9,7 +8,6 @@ import { SendTextDetailsComponent } from "./components/send-details/send-text-de
|
|||||||
*/
|
*/
|
||||||
export type SendForm = {
|
export type SendForm = {
|
||||||
sendTextDetailsForm?: SendTextDetailsComponent["sendTextDetailsForm"];
|
sendTextDetailsForm?: SendTextDetailsComponent["sendTextDetailsForm"];
|
||||||
additionalOptions?: AdditionalOptionsSectionComponent["additionalOptionsForm"];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -36,8 +36,9 @@ class TestAddEditFormService implements SendFormService {
|
|||||||
decryptSend(): Promise<SendView> {
|
decryptSend(): Promise<SendView> {
|
||||||
return Promise.resolve(defaultConfig.originalSend as any);
|
return Promise.resolve(defaultConfig.originalSend as any);
|
||||||
}
|
}
|
||||||
async saveSend(send: SendView, file: File | ArrayBuffer): Promise<void> {
|
async saveSend(send: SendView, file: File | ArrayBuffer): Promise<SendView> {
|
||||||
await new Promise((resolve) => setTimeout(resolve, 1000));
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
||||||
|
return send;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ export class DefaultSendFormService implements SendFormService {
|
|||||||
|
|
||||||
async saveSend(send: SendView, file: File | ArrayBuffer, config: SendFormConfig) {
|
async saveSend(send: SendView, file: File | ArrayBuffer, config: SendFormConfig) {
|
||||||
const sendData = await this.sendService.encrypt(send, file, send.password, null);
|
const sendData = await this.sendService.encrypt(send, file, send.password, null);
|
||||||
await this.sendApiService.save(sendData);
|
return await this.sendApiService.save(sendData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user