Closed sutra closed 4 years ago
To be honest, I don't think that this is something that should be included into the project.
This doesn't have anything with the bot, since it's a simple nginx file serve configuration.
On top of that, a more safe and ideal config should look something like this:
server {
listen 443 ssl http2;
client_max_body_size 10000m;
server_name {{ nginx_domain }};
error_log /var/log/nginx/files_error.log;
access_log /var/log/nginx/files_access.log;
disable_symlinks off;
location / {
auth_basic "Restricted";
auth_basic_user_file /etc/nginx/auth_file;
autoindex on;
autoindex_exact_size off;
root {{ path }};
}
}
This doesn't need any changes to the bot and automatically serves all files with nginx configuration only.
Adding http preview/download capabilities can be easily achieved with other and better fitting tools.
There's stuff like nextcloud and droppy, which already offer a full feature set. It doesn't feel right to have this included into the bot, since this also comes with some privacy/security implications.
Actually I need a mechanism to customize the replied message. Maybe some scripts path could be configured, and the scripts accept the variables(such as the ${subscriber.chat_name} and the directory path of the zip files) and return the message to be sent to the Telegram group. And further we can do more in the scripts, such as rsync-ing the zip files to somewhere.
So, as far as I understand, you want some kind of customizable callback via templating.
As long is this is encapsulated and purely optional feature, I don't see why this couldn't be added to the project :).
Give the jinja templating engine a look, if you're interested in properly implementing this :)
I would suggest to create a new PR for this feature. This PR will be closed for now, since it's out of scope for this project.
And this is a sample nginx conf: