commits
This commit introduces configurations for Dependabot to manage
dependencies, GitHub Actions for security audits, and a CI/CD pipeline
for testing and Docker builds. This includes a PR template and gitignore
updates to improve workflow.
Removes the now-unused constants files for handles, posts, and profiles.
These files were created for rules that are no longer in use.
This change persists the session to disk, allowing the agent to resume
without re-authenticating. This avoids hitting login rate limits and
improves startup time.
Allow `label` to be a string or an array of strings in
`TrackedLabelConfig`. This allows a single account label to be triggered
by multiple post labels.
Refactor `trackPostLabel` to iterate through all matching configs. If a
post label matches multiple configs, each config will be processed
independently. This is useful when one post label might contribute to
multiple account label thresholds.
The `accountLabel` key is now used consistently in all Redis keys,
logging, and metrics.
Updated tests to reflect new functionality.
Adds scripts for running and developing the application using Node.js
and tsx. This provides an alternative execution environment.
Use the oven/bun base image for faster builds. Cache the dependency
installation to speed up the build process.
Adds documentation for running tests and includes integration tests
using testcontainers.
Refactors addPostAndCheckThreshold to accept a client for easier
testing.
Adds testcontainers dependency.
feat: Add integration tests and documentation for testing
This commit introduces a new feature to track labeled posts using Redis
and trigger account-level actions when thresholds are met. It includes
the following changes:
- Added Redis configuration to `.env.example` and the `compose.yaml`
file to run Redis. - Implemented post tracking logic using Redis. -
Added functionality to apply account labels, report accounts, and
comment on accounts based on label thresholds. - Added example
configuration files (`tracked-labels.json` and
`tracked-labels.example.json`). - Implemented Prometheus metrics for
monitoring label tracking and account actions. - Added a health check
endpoint. - Updated `README.md` with instructions on how to use the new
feature.
Integrate `trackPostLabel` and `triggerAccountLabel` functions to handle
post labeling and potential account-level actions based on labeling
thresholds. Added unit tests to verify the integration. Also added a
test for error handling.
This commit introduces the `triggerAccountLabel` function, which handles
actions on an account when a post label threshold is met. The function
labels, optionally reports, and optionally comments on the account.
Comprehensive unit tests are included to cover various scenarios,
including error handling.
Adds a test suite to validate the configuration schema for tracked
labels. Includes tests for both valid and invalid configurations. Also
adds an example `tracked-labels.example.json` file.
This commit adds the ability to load and validate the
`tracked-labels.json` configuration file, which defines the labels to
track.
It includes: - `validateTrackedLabelConfig`: Function to validate a
single configuration object. - `loadTrackedLabels`: Function to load,
parse, and validate the JSON file. - `TRACKED_LABELS`: Constant
containing the loaded and validated configuration, loaded at startup.
This commit adds tests for the `countStarterPacks`, `checkPosts`, and
`checkProfiles` functions. These tests cover various scenarios,
including whitelisting, language filtering, URL resolution, and
moderation actions.
The URL regex was updated to be case-insensitive to ensure that
shortened URLs are correctly resolved. Also added more logging for
debugging purposes.
Allowlists are now checked via an array. Added more logging. Improved
error handling.
Refactor countStarterPacks rule
Use a whitelist for allowed DIDs and improve logging.
- Use HEAD requests first, falling back to GET - Add a user agent to the
request headers - Improve error logging - Increase the timeout to 15
seconds
This commit splits the `utils.ts` file into three separate files: -
`utils/utils.ts`: Contains the `normalizeUnicode` function. -
`utils/getFinalUrl.ts`: Contains the `getFinalUrl` function. -
`utils/getLanguage.ts`: Contains the `getLanguage` function. This
improves code organization and readability.
feat: Split utils into separate files
Move rule-related files into dedicated subdirectories to improve
organization.
1. line 124: changed replyingDid → actorDid (this was causing your
error) 2. line 126: added replyToPostURI to capture the full parent
URI 3. lines 133-158: added quote post monitoring - now detects when
someone quotes a monitored DID or post
the error should be gone now. the system will now: - monitor replies
to your configured government DIDs - monitor quote posts of those same
DIDs - monitor specific post URIs if you add them to monitoredPostURIs
Use the correct PLC URL.
Improve account age lookup by fetching the audit log from the PLC and
using `createdAt` instead of `indexedAt` from the profile.
This commit adds a check to the `checkAccountAge` function to prevent
duplicate labels from being applied to the same account. It uses the
`checkAccountLabels` function to determine if a label already exists
before attempting to create a new one. This prevents redundant labeling
and improves efficiency. Also includes unit tests for the
`checkAccountLabels` function to ensure correct behavior.
This change updates the account age check to use a date window defined
by the anchor date and max age days. Instead of calculating the age, it
now checks if the account creation date falls within the specified
window. This simplifies the logic and makes it more readable.
Additionally, the test suite has been updated to reflect the new
behavior, and a more descriptive comment has been added.
The logic was reversed, incorrectly logging and flagging allowlisted
DIDs. This commit corrects the conditional checks in `checkHandles.ts`,
`checkPosts.ts`, and `checkProfiles.ts` to properly process allowlisted
DIDs.
- Renamed files and directories to the `rules` structure. - Added global
allowlist check.
This adds a global allowlist to bypass moderation checks for specified
DIDs. This is to allow certain accounts to bypass checks for testing and
other use cases.
The allowlist is checked in checkHandles, checkPosts, checkProfiles, and
checkDisplayName functions.
Add a global allowlist to bypass checks for specific DIDs. This is
implemented in checkHandles, checkPosts, checkProfiles, and
checkDisplayName.
Allow `label` to be a string or an array of strings in
`TrackedLabelConfig`. This allows a single account label to be triggered
by multiple post labels.
Refactor `trackPostLabel` to iterate through all matching configs. If a
post label matches multiple configs, each config will be processed
independently. This is useful when one post label might contribute to
multiple account label thresholds.
The `accountLabel` key is now used consistently in all Redis keys,
logging, and metrics.
Updated tests to reflect new functionality.
This commit introduces a new feature to track labeled posts using Redis
and trigger account-level actions when thresholds are met. It includes
the following changes:
- Added Redis configuration to `.env.example` and the `compose.yaml`
file to run Redis. - Implemented post tracking logic using Redis. -
Added functionality to apply account labels, report accounts, and
comment on accounts based on label thresholds. - Added example
configuration files (`tracked-labels.json` and
`tracked-labels.example.json`). - Implemented Prometheus metrics for
monitoring label tracking and account actions. - Added a health check
endpoint. - Updated `README.md` with instructions on how to use the new
feature.
This commit adds the ability to load and validate the
`tracked-labels.json` configuration file, which defines the labels to
track.
It includes: - `validateTrackedLabelConfig`: Function to validate a
single configuration object. - `loadTrackedLabels`: Function to load,
parse, and validate the JSON file. - `TRACKED_LABELS`: Constant
containing the loaded and validated configuration, loaded at startup.
This commit splits the `utils.ts` file into three separate files: -
`utils/utils.ts`: Contains the `normalizeUnicode` function. -
`utils/getFinalUrl.ts`: Contains the `getFinalUrl` function. -
`utils/getLanguage.ts`: Contains the `getLanguage` function. This
improves code organization and readability.
feat: Split utils into separate files
1. line 124: changed replyingDid → actorDid (this was causing your
error) 2. line 126: added replyToPostURI to capture the full parent
URI 3. lines 133-158: added quote post monitoring - now detects when
someone quotes a monitored DID or post
the error should be gone now. the system will now: - monitor replies
to your configured government DIDs - monitor quote posts of those same
DIDs - monitor specific post URIs if you add them to monitoredPostURIs
This commit adds a check to the `checkAccountAge` function to prevent
duplicate labels from being applied to the same account. It uses the
`checkAccountLabels` function to determine if a label already exists
before attempting to create a new one. This prevents redundant labeling
and improves efficiency. Also includes unit tests for the
`checkAccountLabels` function to ensure correct behavior.
This change updates the account age check to use a date window defined
by the anchor date and max age days. Instead of calculating the age, it
now checks if the account creation date falls within the specified
window. This simplifies the logic and makes it more readable.
Additionally, the test suite has been updated to reflect the new
behavior, and a more descriptive comment has been added.