-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace Twitter/Facebook with BlueSky
- Loading branch information
1 parent
4867f23
commit cbfa6dc
Showing
11 changed files
with
249 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (c) 2019-2024 Bjoern Kimminich & the OWASP Juice Shop contributors. | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
const logger = require('./logger') | ||
const colors = require('colors') | ||
const { AtpAgent } = require('@atproto/api') | ||
const agent = new AtpAgent({ service: 'https://bsky.social' }) | ||
|
||
module.exports = async (post) => { | ||
if (process.env.PUBLISHING_MODE) { | ||
try { | ||
await agent.login({ | ||
identifier: process.env.BLUESKY_IDENTIFIER, | ||
password: process.env.BLUESKY_PASSWORD | ||
}) | ||
|
||
const res = await agent.api.com.atproto.repo.createRecord({ | ||
repo: agent.session.did, | ||
collection: 'app.bsky.feed.post', | ||
record: { | ||
text: post, | ||
createdAt: new Date().toISOString() | ||
} | ||
}) | ||
|
||
logger.info(`[${colors.green('✔')}] Post published: ${res}`) | ||
} catch (error) { | ||
logger.warn(`[${colors.red('❌')}] Post failed: ${colors.red(error)}`) | ||
} | ||
} else { | ||
logger.info(`[${colors.yellow('❌')}] Skipped BlueSky post: ${colors.yellow('Post will only be published when PUBLISHING_MODE is set as an environment variable')}`) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.