Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/platforms/Bluesky/Bluesky.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,16 @@ export default class Bluesky extends Platform {
await this.auth.setupCli();
return await this.test();
}
if (!payload) {
throw this.user.log.error("Setup via api requires a payload");
if (operator.ui === "api") {
if (!payload) {
throw this.user.log.error("Bluesky setup requires a payload");
}
await this.auth.setupApi(payload);
return await this.test();
}
return await this.auth.setupApi(payload);
throw this.user.log.error(
`Platform.setup: ui ${operator.ui} not supported`,
);
}

/** @inheritdoc */
Expand Down
14 changes: 11 additions & 3 deletions src/platforms/Bluesky/BlueskyAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,17 @@ export default class BlueskyAuth {
console.log("Credentials stored.");
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
public async setupApi(payload: object) {
throw this.user.log.error("BlueskyAuth:setupApi - not implemented");
public async setupApi(payload: { identifier?: string; password?: string }) {
if (!payload.identifier) {
throw this.user.log.error("BlueskyAuth:setupApi - identifier missing");
}
if (!payload.password) {
throw this.user.log.error("BlueskyAuth:setupApi - app password missing");
}
await this.store({
identifier: payload.identifier,
password: payload.password,
});
}

/**
Expand Down