[Install] WantedBy=multi-user.target
[Unit] Description=CDNMIMU ImagePNG Bot After=network.target [Service] Type=simple User=youruser WorkingDirectory=/home/youruser/bot-imagepng ExecStart=/usr/bin/npm start Restart=on-failure
To keep the bot alive 24/7:
# Ubuntu/Debian sudo apt-get install libpng-dev libvips-dev sudo yum install libpng-devel vips-devel Step 5: Test the CDN Connection Most bots come with a test script. Run:
[INFO] CDNMIMU Bot v2.1.0 started [INFO] Loaded 8 image commands. [INFO] Listening for events on port 3000. If the bot is for Discord, invite it using OAuth2 with SEND_MESSAGES and ATTACH_FILES permissions. Then type: cdnmimu bot imagepng install
sudo nano /etc/systemd/system/cdnmimu-bot.service Paste:
const MAX_PNG_SIZE = 10 * 1024 * 1024; // 10 MB if (imageBuffer.length > MAX_PNG_SIZE) throw new Error('PNG too large'); Run the bot in a Docker container with limited resources: [Install] WantedBy=multi-user
sudo systemctl enable cdnmimu-bot sudo systemctl start cdnmimu-bot Running a bot that interacts with a CDN and manipulates images carries risks. Follow these rules. 7.1 Validate All Incoming URLs Never let users pass arbitrary file paths. Use a whitelist of allowed CDNMIMU buckets or enforce HTTPS with a domain regex. 7.2 Set File Size Limits In your bot code: