postiz-app
postiz-app copied to clipboard
Development has been made to allow X users to generate and use their own APIKEY and Access Token
…own APIKEY and Access Token. By setting ENABLE_X_SELF="true" in the .env file, each user can use their own API Key.
What kind of change does this PR introduce?
A feature
Why was this change needed?
Some self-hosters may prefer each user to generate their own API Token and Access Key instead of using a shared X API. This is because Twitter APIs are quite expensive.
Other information:
eg: Did you discuss this change with anybody before working on it?
No, I needed it and developed.
Checklist:
Put a "X" in the boxes below to indicate you have followed the checklist;
- [ x ] I have read the CONTRIBUTING guide.
- [ x] I checked that there were not similar issues or PRs already open for this.
- [ x ] This PR fixes just ONE issue (do not include multiple issues or types of change in the same PR) For example, don't try and fix a UI issue and include new dependencies in the same PR.
Summary by CodeRabbit
-
New Features
- Introduced a new configuration setting to enable integration with self-generated tokens.
- Added
XSelfProviderto enhance functionality related to social media interactions. - Implemented validation logic for media posts, including image and video limits.
- Added methods for auto-reposting and auto-plugging posts based on engagement metrics.
-
Bug Fixes
- Improved error handling and control flow for provider components.
-
Style
- Reformatted code for consistency in import statements and component signatures.
Someone is attempting to deploy a commit to the Listinai Team on Vercel.
A member of the Team first needs to authorize it.
Walkthrough
The changes introduce a new integration feature with self-generated tokens, encapsulated in a new environment variable ENABLE_X_SELF. This modification is reflected in the .env.example file. Additionally, a new provider, XSelfProvider, is added to handle interactions with the Twitter API, including functionalities for auto-reposting and managing posts based on engagement metrics. The integration manager is updated to conditionally instantiate XSelfProvider based on the environment variable. Various formatting updates and new methods related to the XSelfProvider class are also included.
Changes
| File | Change Summary |
|---|---|
.env.example |
Added new setting ENABLE_X_SELF="true" under "Developer Settings". |
apps/frontend/src/components/launches/providers/show.all.providers.tsx |
Reformatted import statements, added XSelfProvider to the Providers array, and updated the ShowAllProviders component signature for consistency. |
apps/frontend/src/components/launches/providers/xself/xself.provider.tsx |
Introduced xself.provider.tsx with validation logic for media posts, including checks for images and video duration. Added checkVideoDuration function. |
libraries/nestjs-libraries/src/integrations/integration.manager.ts |
Updated socialIntegrationList initialization to conditionally instantiate XSelfProvider based on ENABLE_X_SELF. |
libraries/nestjs-libraries/src/integrations/social/xself.provider.ts |
Added XSelfProvider class with methods for Twitter API interactions, including customFields, autoRepostPost, autoPlugPost, refreshToken, generateAuthUrl, authenticate, and post. |
Sequence Diagram(s)
sequenceDiagram
participant Dev as Developer
participant Env as Environment
participant Int as Integration Manager
participant XSP as XSelfProvider
participant API as Twitter API
Dev->>Env: Set ENABLE_X_SELF=true
Env->>Int: Initialize socialIntegrationList
Int->>XSP: Instantiate XSelfProvider
XSP->>API: Interact with Twitter API
API-->>XSP: Return API Response
XSP-->>Int: Provide functionality
🐰 "In the code, a new feature hops,
With tokens that bring new shops.
XSelfProvider joins the dance,
For Twitter's tweets, a chance!
With validations and methods bright,
Our integration takes to flight!" 🐇✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
🪧 Tips
Chat
There are 3 ways to chat with CodeRabbit:
- Review comments: Directly reply to a review comment made by CodeRabbit. Example:
I pushed a fix in commit <commit_id>, please review it.Generate unit testing code for this file.Open a follow-up GitHub issue for this discussion.
- Files and specific lines of code (under the "Files changed" tab): Tag
@coderabbitaiin a new review comment at the desired location with your query. Examples:@coderabbitai generate unit testing code for this file.@coderabbitai modularize this function.
- PR comments: Tag
@coderabbitaiin a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:@coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.@coderabbitai read src/utils.ts and generate unit testing code.@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.@coderabbitai help me debug CodeRabbit configuration file.
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.
CodeRabbit Commands (Invoked using PR comments)
@coderabbitai pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR. (Experiment)@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile to the root of your repository. - Please see the configuration documentation for more information.
- If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation:
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
Documentation and Community
- Visit our Documentation for detailed information on how to use CodeRabbit.
- Join our Discord Community to get help, request features, and share feedback.
- Follow us on X/Twitter for updates and announcements.
Thank you for the pull request. We must review it more deeply as it adds a new provider (instead of adding the option for the initial one)
This PR is stale because it has been open for 90 days with no activity.
This PR was closed because it has been inactive for 7 days since being marked as stale.