Skip to content

Instantly share code, notes, and snippets.

@stek29
Created February 24, 2019 21:52
Show Gist options
  • Save stek29/47a4a02c4fb82d79dbe52d4f36efe163 to your computer and use it in GitHub Desktop.
Save stek29/47a4a02c4fb82d79dbe52d4f36efe163 to your computer and use it in GitHub Desktop.
config for nginx to proxy webogram
server {
server_name gram.com;
location / {
root /var/www/gram;
try_files $uri $uri/index.html;
# protect with basic auth, we don't want to get banned by rkn
auth_basic "webogram";
auth_basic_user_file /var/www/gram.htpasswd;
}
listen [::]:443 ssl;
listen 443 ssl;
# Change one, then do
# (for x in '' '-1'; do for i in pluto venus aurora vesta flora; (pbpaste|sed "s/pluto/$i$x/g" && printf "\n\n"); done)|pbcopy
location /pluto {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/pluto$ / break;
rewrite ^/pluto(.*)$ $1 break;
proxy_pass https://pluto.web.telegram.org;
expires off;
access_log off;
}
location /venus {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/venus$ / break;
rewrite ^/venus(.*)$ $1 break;
proxy_pass https://venus.web.telegram.org;
expires off;
access_log off;
}
location /aurora {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/aurora$ / break;
rewrite ^/aurora(.*)$ $1 break;
proxy_pass https://aurora.web.telegram.org;
expires off;
access_log off;
}
location /vesta {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/vesta$ / break;
rewrite ^/vesta(.*)$ $1 break;
proxy_pass https://vesta.web.telegram.org;
expires off;
access_log off;
}
location /flora {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/flora$ / break;
rewrite ^/flora(.*)$ $1 break;
proxy_pass https://flora.web.telegram.org;
expires off;
access_log off;
}
location /pluto-1 {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/pluto-1$ / break;
rewrite ^/pluto-1(.*)$ $1 break;
proxy_pass https://pluto-1.web.telegram.org;
expires off;
access_log off;
}
location /venus-1 {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/venus-1$ / break;
rewrite ^/venus-1(.*)$ $1 break;
proxy_pass https://venus-1.web.telegram.org;
expires off;
access_log off;
}
location /aurora-1 {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/aurora-1$ / break;
rewrite ^/aurora-1(.*)$ $1 break;
proxy_pass https://aurora-1.web.telegram.org;
expires off;
access_log off;
}
location /vesta-1 {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/vesta-1$ / break;
rewrite ^/vesta-1(.*)$ $1 break;
proxy_pass https://vesta-1.web.telegram.org;
expires off;
access_log off;
}
location /flora-1 {
valid_referers server_names;
if ($invalid_referer) {
return 403;
}
rewrite ^/flora-1$ / break;
rewrite ^/flora-1(.*)$ $1 break;
proxy_pass https://flora-1.web.telegram.org;
expires off;
access_log off;
}
ssl_certificate /etc/letsencrypt/live/gram.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/gram.com/privkey.pem;
}
server {
listen 80;
listen [::]:80;
server_name gram.stek29.rocks;
return 301 https://$host$request_uri;
}
diff --git a/js/lib/mtproto.js b/js/lib/mtproto.js
index c6529f2..39d318e 100644
--- a/js/lib/mtproto.js
+++ b/js/lib/mtproto.js
@@ -33,8 +33,8 @@ angular.module('izhukov.mtproto', ['izhukov.utils'])
if (Config.Modes.ssl || !Config.Modes.http) {
var subdomain = sslSubdomains[dcID - 1] + (upload ? '-1' : '')
- var path = Config.Modes.test ? 'apiw_test1' : 'apiw1'
- chosenServer = 'https://' + subdomain + '.web.telegram.org/' + path
+ var path = Config.Modes.test ? '/apiw_test1' : '/apiw1'
+ chosenServer = 'https://gram.stek29.rocks/' + subdomain + path
return chosenServer
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment