text0Nly/README
Lain Iwakura 9afe6dc04e
renamed
2025-06-16 01:46:31 +03:00

129 lines
3.5 KiB
Plaintext

Text0Nly - Simple PGP-enabled messenger
Installation:
1. Database setup:
a. Start MySQL and set root password:
mysql_secure_installation
# Follow prompts to set root password and secure installation
b. Create database and user:
mysql -u root -p
# Enter your root password when prompted
CREATE DATABASE messenger;
USE messenger;
source main/db.sql;
# Create user with password
CREATE USER 'messenger'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON messenger.* TO 'messenger'@'localhost';
FLUSH PRIVILEGES;
exit;
c. Test connection:
mysql -u messenger -p
# Enter your messenger user password
# If you can connect, the user is set up correctly
2. Configuration:
Copy main/config.php.example to main/config.php
Edit main/config.php and set your database credentials:
- host: usually 'localhost'
- name: 'messenger'
- user: 'messenger'
- pass: your_secure_password from step 1b
3. Apache setup:
CentOS:
yum install httpd php php-mysqlnd mariadb-server
cp configs/apache.conf.centos /etc/httpd/conf.d/text0nly.conf
cp configs/php.ini /etc/php.ini
chown -R apache:apache /var/www/html/main
chmod -R 755 /var/www/html/main
systemctl start mariadb
systemctl enable mariadb
systemctl start httpd
systemctl enable httpd
Alpine:
apk add apache2 php php-mysql mariadb
cp configs/apache.conf.debian /etc/apache2/sites-available/text0nly.conf
cp configs/php.ini /etc/php/php.ini
chown -R www-data:www-data /var/www/html/main
chmod -R 755 /var/www/html/main
ln -s /etc/apache2/sites-available/text0nly.conf /etc/apache2/sites-enabled/
rc-update add mariadb default
rc-update add apache2 default
rc-service mariadb start
rc-service apache2 start
Debian:
apt install apache2 php mariadb-server
cp configs/apache.conf.debian /etc/apache2/sites-available/text0nly.conf
cp configs/php.ini /etc/php/php.ini
chown -R www-data:www-data /var/www/html/main
chmod -R 755 /var/www/html/main
a2ensite text0nly.conf
systemctl start mariadb
systemctl enable mariadb
systemctl start apache2
systemctl enable apache2
Files:
main/ - Web files
configs/ - Server configs
configs/apache.conf.centos - Apache config for CentOS
configs/apache.conf.debian - Apache config for Debian/Alpine
configs/php.ini - PHP configuration
main/config.php - Database configuration (create from config.php.example)
main/db.sql - Database structure
main/index.php - Main page
main/register.php - Registration
main/api.php - Message API
API usage:
GET /api.php - Get messages
Parameters:
- limit: number of messages (1-100, default: 50)
Example:
curl http://localhost/api.php?limit=10
Response:
{
"messages": [
{
"username": "user",
"message": "text",
"created_at": "2024-03-21 12:34:56",
"signature": "[Signed]",
"is_encrypted": true
}
]
}
POST /api.php - Send message
Headers:
- Content-Type: application/json
Body:
{
"username": "name",
"message": "text",
"signature": "pgp_signature",
"encrypted": true
}
Example:
curl -X POST http://localhost/api.php -H "Content-Type: application/json" -d '{
"username": "name",
"message": "text",
"signature": "pgp_signature",
"encrypted": true
}'
Note: Messages can only be sent by unregistered usernames