mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -69,7 +69,7 @@ export class CompletionCommand {
|
||||
.concat(
|
||||
`'(-h --help)'{-h,--help}'[output usage information]'`,
|
||||
hasCommands ? '"1: :->cmnds"' : null,
|
||||
'"*::arg:->args"'
|
||||
'"*::arg:->args"',
|
||||
)
|
||||
.filter(Boolean);
|
||||
|
||||
@@ -100,7 +100,7 @@ export class CompletionCommand {
|
||||
${commands
|
||||
.map(({ _name }) => [`${_name})`, `_${name}_${_name}`, ";;"].join("\n "))
|
||||
.join("\n ")}
|
||||
esac`
|
||||
esac`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ export class CompletionCommand {
|
||||
|
||||
if (hasCommands) {
|
||||
commandBlocParts.push(
|
||||
commands.map((c) => this.renderCommandBlock(`${name}_${c._name}`, c)).join("\n\n")
|
||||
commands.map((c) => this.renderCommandBlock(`${name}_${c._name}`, c)).join("\n\n"),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ export class ConfigCommand {
|
||||
const stringRes = new StringResponse(
|
||||
this.environmentService.hasBaseUrl()
|
||||
? this.environmentService.getUrls().base
|
||||
: "https://bitwarden.com"
|
||||
: "https://bitwarden.com",
|
||||
);
|
||||
return Response.success(stringRes);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ export class ConvertToKeyConnectorCommand {
|
||||
private environmentService: EnvironmentService,
|
||||
private syncService: SyncService,
|
||||
private organizationApiService: OrganizationApiServiceAbstraction,
|
||||
private logout: () => Promise<void>
|
||||
private logout: () => Promise<void>,
|
||||
) {}
|
||||
|
||||
async run(): Promise<Response> {
|
||||
@@ -26,8 +26,8 @@ export class ConvertToKeyConnectorCommand {
|
||||
new MessageResponse(
|
||||
"An organization you are a member of is using Key Connector. " +
|
||||
"In order to access the vault, you must opt-in to Key Connector now via the web vault. You have been logged out.",
|
||||
null
|
||||
)
|
||||
null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@ export abstract class DownloadCommand {
|
||||
url: string,
|
||||
key: SymmetricCryptoKey,
|
||||
fileName: string,
|
||||
output?: string
|
||||
output?: string,
|
||||
) {
|
||||
const response = await fet.default(new fet.Request(url, { headers: { cache: "no-cache" } }));
|
||||
if (response.status !== 200) {
|
||||
return Response.error(
|
||||
"A " + response.status + " error occurred while downloading the attachment."
|
||||
"A " + response.status + " error occurred while downloading the attachment.",
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ export class EditCommand {
|
||||
private folderService: FolderService,
|
||||
private cryptoService: CryptoService,
|
||||
private apiService: ApiService,
|
||||
private folderApiService: FolderApiServiceAbstraction
|
||||
private folderApiService: FolderApiServiceAbstraction,
|
||||
) {}
|
||||
|
||||
async run(
|
||||
object: string,
|
||||
id: string,
|
||||
requestJson: any,
|
||||
cmdOptions: Record<string, any>
|
||||
cmdOptions: Record<string, any>,
|
||||
): Promise<Response> {
|
||||
if (process.env.BW_SERVE !== "true" && (requestJson == null || requestJson === "")) {
|
||||
requestJson = await CliUtils.readStdin();
|
||||
@@ -78,7 +78,7 @@ export class EditCommand {
|
||||
}
|
||||
|
||||
let cipherView = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
if (cipherView.isDeleted) {
|
||||
return Response.badRequest("You may not edit a deleted item. Use the restore command first.");
|
||||
@@ -89,7 +89,7 @@ export class EditCommand {
|
||||
await this.cipherService.updateWithServer(encCipher);
|
||||
const updatedCipher = await this.cipherService.get(cipher.id);
|
||||
const decCipher = await updatedCipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher),
|
||||
);
|
||||
const res = new CipherResponse(decCipher);
|
||||
return Response.success(res);
|
||||
@@ -105,7 +105,7 @@ export class EditCommand {
|
||||
}
|
||||
if (cipher.organizationId == null) {
|
||||
return Response.badRequest(
|
||||
"Item does not belong to an organization. Consider moving it first."
|
||||
"Item does not belong to an organization. Consider moving it first.",
|
||||
);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ export class EditCommand {
|
||||
await this.cipherService.saveCollectionsWithServer(cipher);
|
||||
const updatedCipher = await this.cipherService.get(cipher.id);
|
||||
const decCipher = await updatedCipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(updatedCipher),
|
||||
);
|
||||
const res = new CipherResponse(decCipher);
|
||||
return Response.success(res);
|
||||
@@ -146,7 +146,7 @@ export class EditCommand {
|
||||
private async editOrganizationCollection(
|
||||
id: string,
|
||||
req: OrganizationCollectionRequest,
|
||||
options: Options
|
||||
options: Options,
|
||||
) {
|
||||
if (options.organizationId == null || options.organizationId === "") {
|
||||
return Response.badRequest("`organizationid` option is required.");
|
||||
@@ -170,7 +170,7 @@ export class EditCommand {
|
||||
req.groups == null
|
||||
? null
|
||||
: req.groups.map(
|
||||
(g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords, g.manage)
|
||||
(g) => new SelectionReadOnlyRequest(g.id, g.readOnly, g.hidePasswords, g.manage),
|
||||
);
|
||||
const request = new CollectionRequest();
|
||||
request.name = (await this.cryptoService.encrypt(req.name, orgKey)).encryptedString;
|
||||
|
||||
@@ -56,7 +56,7 @@ export class GetCommand extends DownloadCommand {
|
||||
private searchService: SearchService,
|
||||
private apiService: ApiService,
|
||||
private organizationService: OrganizationService,
|
||||
private eventCollectionService: EventCollectionService
|
||||
private eventCollectionService: EventCollectionService,
|
||||
) {
|
||||
super(cryptoService);
|
||||
}
|
||||
@@ -107,7 +107,7 @@ export class GetCommand extends DownloadCommand {
|
||||
const cipher = await this.cipherService.get(id);
|
||||
if (cipher != null) {
|
||||
decCipher = await cipher.decrypt(
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher)
|
||||
await this.cipherService.getKeyForCipherKeyDecryption(cipher),
|
||||
);
|
||||
}
|
||||
} else if (id.trim() !== "") {
|
||||
@@ -145,7 +145,7 @@ export class GetCommand extends DownloadCommand {
|
||||
EventType.Cipher_ClientViewed,
|
||||
id,
|
||||
true,
|
||||
decCipher.organizationId
|
||||
decCipher.organizationId,
|
||||
);
|
||||
|
||||
const res = new CipherResponse(decCipher);
|
||||
@@ -155,7 +155,7 @@ export class GetCommand extends DownloadCommand {
|
||||
private async getUsername(id: string) {
|
||||
const cipherResponse = await this.getCipher(
|
||||
id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.username)
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.username),
|
||||
);
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
@@ -177,7 +177,7 @@ export class GetCommand extends DownloadCommand {
|
||||
private async getPassword(id: string) {
|
||||
const cipherResponse = await this.getCipher(
|
||||
id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.password)
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.password),
|
||||
);
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
@@ -203,7 +203,7 @@ export class GetCommand extends DownloadCommand {
|
||||
c.type === CipherType.Login &&
|
||||
c.login.uris != null &&
|
||||
c.login.uris.length > 0 &&
|
||||
c.login.uris[0].uri !== ""
|
||||
c.login.uris[0].uri !== "",
|
||||
);
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
@@ -229,7 +229,7 @@ export class GetCommand extends DownloadCommand {
|
||||
private async getTotp(id: string) {
|
||||
const cipherResponse = await this.getCipher(
|
||||
id,
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.totp)
|
||||
(c) => c.type === CipherType.Login && !Utils.isNullOrWhitespace(c.login.totp),
|
||||
);
|
||||
if (!cipherResponse.success) {
|
||||
return cipherResponse;
|
||||
@@ -287,7 +287,7 @@ export class GetCommand extends DownloadCommand {
|
||||
}
|
||||
|
||||
const exposedNumber = await this.auditService.passwordLeaked(
|
||||
(passwordResponse.data as StringResponse).data
|
||||
(passwordResponse.data as StringResponse).data,
|
||||
);
|
||||
const res = new StringResponse(exposedNumber.toString());
|
||||
return Response.success(res);
|
||||
@@ -317,7 +317,7 @@ export class GetCommand extends DownloadCommand {
|
||||
let attachments = cipher.attachments.filter(
|
||||
(a) =>
|
||||
a.id.toLowerCase() === id ||
|
||||
(a.fileName != null && a.fileName.toLowerCase().indexOf(id) > -1)
|
||||
(a.fileName != null && a.fileName.toLowerCase().indexOf(id) > -1),
|
||||
);
|
||||
if (attachments.length === 0) {
|
||||
return Response.error("Attachment `" + id + "` was not found.");
|
||||
@@ -343,7 +343,7 @@ export class GetCommand extends DownloadCommand {
|
||||
try {
|
||||
const attachmentDownloadResponse = await this.apiService.getAttachmentData(
|
||||
cipher.id,
|
||||
attachments[0].id
|
||||
attachments[0].id,
|
||||
);
|
||||
url = attachmentDownloadResponse.url;
|
||||
} catch (e) {
|
||||
@@ -433,13 +433,13 @@ export class GetCommand extends DownloadCommand {
|
||||
const decCollection = new CollectionView(response);
|
||||
decCollection.name = await this.cryptoService.decryptToUtf8(
|
||||
new EncString(response.name),
|
||||
orgKey
|
||||
orgKey,
|
||||
);
|
||||
const groups =
|
||||
response.groups == null
|
||||
? null
|
||||
: response.groups.map(
|
||||
(g) => new SelectionReadOnly(g.id, g.readOnly, g.hidePasswords, g.manage)
|
||||
(g) => new SelectionReadOnly(g.id, g.readOnly, g.hidePasswords, g.manage),
|
||||
);
|
||||
const res = new OrganizationCollectionResponse(decCollection, groups);
|
||||
return Response.success(res);
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ListCommand {
|
||||
private searchService: SearchService,
|
||||
private organizationUserService: OrganizationUserService,
|
||||
private apiService: ApiService,
|
||||
private eventCollectionService: EventCollectionService
|
||||
private eventCollectionService: EventCollectionService,
|
||||
) {}
|
||||
|
||||
async run(object: string, cmdOptions: Record<string, any>): Promise<Response> {
|
||||
@@ -133,7 +133,7 @@ export class ListCommand {
|
||||
EventType.Cipher_ClientViewed,
|
||||
c.id,
|
||||
index === ciphers.length - 1,
|
||||
c.organizationId
|
||||
c.organizationId,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -229,7 +229,7 @@ export class ListCommand {
|
||||
u.type = r.type;
|
||||
u.twoFactorEnabled = r.twoFactorEnabled;
|
||||
return u;
|
||||
})
|
||||
}),
|
||||
);
|
||||
return Response.success(res);
|
||||
} catch (e) {
|
||||
|
||||
@@ -67,7 +67,7 @@ export class ServeCommand {
|
||||
this.main.searchService,
|
||||
this.main.apiService,
|
||||
this.main.organizationService,
|
||||
this.main.eventCollectionService
|
||||
this.main.eventCollectionService,
|
||||
);
|
||||
this.listCommand = new ListCommand(
|
||||
this.main.cipherService,
|
||||
@@ -77,7 +77,7 @@ export class ServeCommand {
|
||||
this.main.searchService,
|
||||
this.main.organizationUserService,
|
||||
this.main.apiService,
|
||||
this.main.eventCollectionService
|
||||
this.main.eventCollectionService,
|
||||
);
|
||||
this.createCommand = new CreateCommand(
|
||||
this.main.cipherService,
|
||||
@@ -85,37 +85,37 @@ export class ServeCommand {
|
||||
this.main.stateService,
|
||||
this.main.cryptoService,
|
||||
this.main.apiService,
|
||||
this.main.folderApiService
|
||||
this.main.folderApiService,
|
||||
);
|
||||
this.editCommand = new EditCommand(
|
||||
this.main.cipherService,
|
||||
this.main.folderService,
|
||||
this.main.cryptoService,
|
||||
this.main.apiService,
|
||||
this.main.folderApiService
|
||||
this.main.folderApiService,
|
||||
);
|
||||
this.generateCommand = new GenerateCommand(
|
||||
this.main.passwordGenerationService,
|
||||
this.main.stateService
|
||||
this.main.stateService,
|
||||
);
|
||||
this.syncCommand = new SyncCommand(this.main.syncService);
|
||||
this.statusCommand = new StatusCommand(
|
||||
this.main.environmentService,
|
||||
this.main.syncService,
|
||||
this.main.stateService,
|
||||
this.main.authService
|
||||
this.main.authService,
|
||||
);
|
||||
this.deleteCommand = new DeleteCommand(
|
||||
this.main.cipherService,
|
||||
this.main.folderService,
|
||||
this.main.stateService,
|
||||
this.main.apiService,
|
||||
this.main.folderApiService
|
||||
this.main.folderApiService,
|
||||
);
|
||||
this.confirmCommand = new ConfirmCommand(
|
||||
this.main.apiService,
|
||||
this.main.cryptoService,
|
||||
this.main.organizationUserService
|
||||
this.main.organizationUserService,
|
||||
);
|
||||
this.restoreCommand = new RestoreCommand(this.main.cipherService);
|
||||
this.shareCommand = new ShareCommand(this.main.cipherService);
|
||||
@@ -130,36 +130,36 @@ export class ServeCommand {
|
||||
this.main.environmentService,
|
||||
this.main.syncService,
|
||||
this.main.organizationApiService,
|
||||
async () => await this.main.logout()
|
||||
async () => await this.main.logout(),
|
||||
);
|
||||
|
||||
this.sendCreateCommand = new SendCreateCommand(
|
||||
this.main.sendService,
|
||||
this.main.stateService,
|
||||
this.main.environmentService,
|
||||
this.main.sendApiService
|
||||
this.main.sendApiService,
|
||||
);
|
||||
this.sendDeleteCommand = new SendDeleteCommand(this.main.sendService, this.main.sendApiService);
|
||||
this.sendGetCommand = new SendGetCommand(
|
||||
this.main.sendService,
|
||||
this.main.environmentService,
|
||||
this.main.searchService,
|
||||
this.main.cryptoService
|
||||
this.main.cryptoService,
|
||||
);
|
||||
this.sendEditCommand = new SendEditCommand(
|
||||
this.main.sendService,
|
||||
this.main.stateService,
|
||||
this.sendGetCommand,
|
||||
this.main.sendApiService
|
||||
this.main.sendApiService,
|
||||
);
|
||||
this.sendListCommand = new SendListCommand(
|
||||
this.main.sendService,
|
||||
this.main.environmentService,
|
||||
this.main.searchService
|
||||
this.main.searchService,
|
||||
);
|
||||
this.sendRemovePasswordCommand = new SendRemovePasswordCommand(
|
||||
this.main.sendService,
|
||||
this.main.sendApiService
|
||||
this.main.sendApiService,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ export class ServeCommand {
|
||||
this.main.logService.info(
|
||||
`Starting server on ${hostname}:${port} with ${
|
||||
protectOrigin ? "origin protection" : "no origin protection"
|
||||
}`
|
||||
}`,
|
||||
);
|
||||
|
||||
const server = new koa();
|
||||
@@ -187,7 +187,7 @@ export class ServeCommand {
|
||||
Utils.isNullOrEmpty(ctx.headers.origin)
|
||||
? "(Origin header value missing)"
|
||||
: ctx.headers.origin
|
||||
}"`
|
||||
}"`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -252,7 +252,7 @@ export class ServeCommand {
|
||||
|
||||
const response = await this.unlockCommand.run(
|
||||
ctx.request.body.password == null ? null : (ctx.request.body.password as string),
|
||||
ctx.request.query
|
||||
ctx.request.query,
|
||||
);
|
||||
this.processResponse(ctx.response, response);
|
||||
await next();
|
||||
@@ -266,7 +266,7 @@ export class ServeCommand {
|
||||
const response = await this.confirmCommand.run(
|
||||
ctx.params.object,
|
||||
ctx.params.id,
|
||||
ctx.request.query
|
||||
ctx.request.query,
|
||||
);
|
||||
this.processResponse(ctx.response, response);
|
||||
await next();
|
||||
@@ -290,7 +290,7 @@ export class ServeCommand {
|
||||
const response = await this.shareCommand.run(
|
||||
ctx.params.id,
|
||||
ctx.params.organizationId,
|
||||
ctx.request.body // TODO: Check the format of this body for an array of collection ids
|
||||
ctx.request.body, // TODO: Check the format of this body for an array of collection ids
|
||||
);
|
||||
this.processResponse(ctx.response, response);
|
||||
await next();
|
||||
@@ -308,7 +308,7 @@ export class ServeCommand {
|
||||
{
|
||||
fileBuffer: ctx.request.file.buffer,
|
||||
fileName: ctx.request.file.originalname,
|
||||
}
|
||||
},
|
||||
);
|
||||
this.processResponse(ctx.response, response);
|
||||
await next();
|
||||
@@ -336,7 +336,7 @@ export class ServeCommand {
|
||||
response = await this.createCommand.run(
|
||||
ctx.params.object,
|
||||
ctx.request.body,
|
||||
ctx.request.query
|
||||
ctx.request.query,
|
||||
);
|
||||
}
|
||||
this.processResponse(ctx.response, response);
|
||||
@@ -357,7 +357,7 @@ export class ServeCommand {
|
||||
ctx.params.object,
|
||||
ctx.params.id,
|
||||
ctx.request.body,
|
||||
ctx.request.query
|
||||
ctx.request.query,
|
||||
);
|
||||
}
|
||||
this.processResponse(ctx.response, response);
|
||||
@@ -391,7 +391,7 @@ export class ServeCommand {
|
||||
response = await this.deleteCommand.run(
|
||||
ctx.params.object,
|
||||
ctx.params.id,
|
||||
ctx.request.query
|
||||
ctx.request.query,
|
||||
);
|
||||
}
|
||||
this.processResponse(ctx.response, response);
|
||||
|
||||
@@ -12,7 +12,7 @@ export class StatusCommand {
|
||||
private envService: EnvironmentService,
|
||||
private syncService: SyncService,
|
||||
private stateService: StateService,
|
||||
private authService: AuthService
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
|
||||
async run(): Promise<Response> {
|
||||
@@ -30,7 +30,7 @@ export class StatusCommand {
|
||||
userEmail: email,
|
||||
userId: userId,
|
||||
status: status,
|
||||
})
|
||||
}),
|
||||
);
|
||||
} catch (e) {
|
||||
return Response.error(e);
|
||||
|
||||
Reference in New Issue
Block a user