From bbc7bb60339ea20870ea2f54142f7110995ac367 Mon Sep 17 00:00:00 2001 From: onezDerv Date: Wed, 18 Sep 2024 18:11:08 -0400 Subject: [PATCH] example conf, change domain --- js/app.js | 8 ++++---- nginx.example.conf | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 nginx.example.conf diff --git a/js/app.js b/js/app.js index 5ba3c9a..6d52fe2 100644 --- a/js/app.js +++ b/js/app.js @@ -39,7 +39,7 @@ async function main(type) { user = user.slice(1); if (typed == '#') { - studios[user] = await (fetch(`https://hf.zenoverse.net/studio/${user}`) + studios[user] = await (fetch(`https://feed.zenoverse.net/studio/${user}`) .then(x => x.json())); } } @@ -57,20 +57,20 @@ async function main(type) { let extraFetch = []; if (typed == '#' && type == '#user') { - extraFetch = await (fetch(`https://hf.zenoverse.net/studio_project/${user}`) + extraFetch = await (fetch(`https://feed.zenoverse.net/studio_project/${user}`) .then(x => x.json())); extraFetch.forEach(x => { x.studio = studios[user ].title; }); } else if (typed == '#' && type == '#comment') { - extraFetch = await (fetch(`https://hf.zenoverse.net/studio_comment/${user}`) + extraFetch = await (fetch(`https://feed.zenoverse.net/studio_comment/${user}`) .then(x => x.json())); extraFetch.forEach(x => { x.studio = studios[user].title; x.studioID = user }); } else if (typed == '@' && type == '#user') { - extraFetch = await (fetch(`https://hf.zenoverse.net/user/${user}`) + extraFetch = await (fetch(`https://feed.zenoverse.net/user/${user}`) .then(x => x.json())); extraFetch.forEach(x => x.username = user); } diff --git a/nginx.example.conf b/nginx.example.conf new file mode 100644 index 0000000..7600954 --- /dev/null +++ b/nginx.example.conf @@ -0,0 +1,27 @@ + +server { + listen 443 ssl; + server_name feed.zenoverse.net; + ssl_certificate /etc/letsencrypt/live/feed.zenoverse.net/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/feed.zenoverse.net/privkey.pem; + location / { + index index.html; + root /main/scratch-feed; + } + location ~ /user/(.*) { + add_header 'Access-Control-Allow-Origin' '*'; + proxy_pass https://api.scratch.mit.edu/users/$1/projects?limit=40; + } + location ~ /studio/(.*) { + add_header 'Access-Control-Allow-Origin' '*'; + proxy_pass https://api.scratch.mit.edu/studios/$1; + } + location ~ /studio_project/(.*) { + add_header 'Access-Control-Allow-Origin' '*'; + proxy_pass https://api.scratch.mit.edu/studios/$1/projects?offset=0&limit=40; + } + location ~ /studio_comment/(.*) { + add_header 'Access-Control-Allow-Origin' '*'; + proxy_pass https://api.scratch.mit.edu/studios/$1/comments?offset=0&limit=40; + } +} \ No newline at end of file