diff --git a/README.md b/README.md index eb8636c..4cdb1b9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,50 @@ -# rdblock +# redlight -An advanced abuse management tool. It's a Synapse module that allows server owners to safely host rdlist, or use rdlist to prevent users from accessing tagged rooms. \ No newline at end of file +

+ redlight logo +

+ +_"The red light means stop!"_ + +An advanced abuse management tool. It's a Synapse module that allows server owners to either run a "redlight server", or to act as a "redlight client" to prevent their own users from accessing abusive rooms. It's designed to block child sexual abuse material (CSAM) and other abusive content on the Matrix network. + +This software attempts to resolve the complex problem of how to share pointers to rooms containing abusive content in order to block or report activity. These room lists are sensitive and sharing them can not only aid people in blocking this content but also direct bad actors to said content. + +The goal of this tool is to simply block this content as efficiently as possible across many small-medium sized servers. + + +## Features + + Easy, setup for homeserver owners via Synapse Module + Private, hashing is used to prevent redlight clients from sharing room_ids with redlight servers + Decentralised, many people can run redlight servers with their own blocking policies, redlight clients are free to pick a provider + Safe, access restrictions and ratelimiting are used to guard the content of rdlist + + +## How it Works + +... + +For a more detailed description of how it will work please consult the [Technical Specification](./technical_spec.md). + +**Coming soon...** + + +## License + +This project is licensed under the MIT License. + + +## Contributing + +We warmly welcome contributors who are interested in improving Matrix Lantern. Whether you're fixing bugs, improving documentation, or proposing new features, your efforts are greatly appreciated. Please ensure that new contributions follow our [Style Guide](./style_guide.md). + + +## Acknowledgements + +Redlight is a community-driven project aimed at protecting the Matrix network's users from harmful content. Our thanks go out to the Matrix network, Glowers Club, and all our contributors who make this project possible. + + +## Roadmap + +1) Get a basic prototype working. diff --git a/hello_world_module.py b/hello_world_module.py new file mode 100644 index 0000000..9efc316 --- /dev/null +++ b/hello_world_module.py @@ -0,0 +1,37 @@ +import logging +from typing import Union +from synapse.module_api import ModuleApi + +logger = logging.getLogger(__name__) + +class HelloWorldModule: + def __init__(self, config: dict, api: ModuleApi): + self._api = api + + # Log a message to indicate the module's initialization + logger.info("HelloWorldModule initialized.") + + # Register the spam checker callback + api.register_spam_checker_callbacks( + user_may_join_room=self.user_may_join_room + ) + + async def user_may_join_room( + self, user: str, room: str, is_invited: bool + ) -> Union["synapse.module_api.NOT_SPAM", "synapse.module_api.errors.Codes"]: + + # Log the event of a user trying to join a room + logger.info(f"User {user} is attempting to join room {room}. Invitation status: {is_invited}.") + + # Log the desired message + logger.info("Hello World!") + + # Return NOT_SPAM to allow the operation (joining the room) + #return self._api.NOT_SPAM + return self._api.errors.Codes.FORBIDDEN + +def parse_config(config: dict) -> dict: + return config + +def create_module(api: ModuleApi, config: dict) -> HelloWorldModule: + return HelloWorldModule(config, api) \ No newline at end of file diff --git a/logo/redlight_logo.jpg b/logo/redlight_logo.jpg new file mode 100644 index 0000000..573143f Binary files /dev/null and b/logo/redlight_logo.jpg differ diff --git a/style_guide.md b/style_guide.md new file mode 100644 index 0000000..3d41896 --- /dev/null +++ b/style_guide.md @@ -0,0 +1,88 @@ +# Matrix Lantern Style Guide + +This guide will help you in understanding the coding style being used in this project. Please adhere to these rules when contributing to the project for better readability and understanding of the code. + + +## Indentation + +Use tabs for indentation. The code uses one tab per indentation level. + + +## Functions + +Use lower case words separated by underscores. Function names should be descriptive of their function. + +``` +def my_function(): + pass +``` + + +## Variables + +Similar to function names, variable names should also be lowercase with words separated by underscores. They should be descriptive. + +``` +# good +my_variable = 10 + +# bad +mv = 10 +``` + + +## Commenting + +Inline comments should be used sparingly. The use of comments is to clarify complex sections of code. If your code is straightforward, there's no need for comments. + +``` +# Good +def complex_algorithm(): + # This line does this... + complex_line_of_code_here + +# Bad +def simple_algorithm(): + # This line increments by 1 + counter += 1 +``` + + +## Function Calls + +Function calls and definitions should have no space between the function name and the parentheses. + +``` +# Good +print("Hello, World!") + +# Bad +print ("Hello, World!") +``` + + +## Constants + +Use uppercase with underscores to declare constants. + +``` +# Good +CONSTANT_NAME = 'Hello, World!' + +# Bad +Constant_name = 'Hello, World!' +constantName = 'Hello, World!' +``` + + +## Default Function Arguments + +When using default arguments, there should be no spaces around the equals sign. + +``` +# Good +def my_func(default_arg='default'): + +# Bad +def my_func(default_arg = 'default'): +``` diff --git a/technical_spec.md b/technical_spec.md new file mode 100644 index 0000000..9743d59 --- /dev/null +++ b/technical_spec.md @@ -0,0 +1,2 @@ + +## add later \ No newline at end of file