Skip to content

Commit

Permalink
Feature/cleanup deployment (#53)
Browse files Browse the repository at this point in the history
* maken going

* add readme

* cleanup deploy dir

* change response loadinger
  • Loading branch information
dutscher committed Jun 6, 2024
1 parent ba6cdc1 commit 4a34e55
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 5 deletions.
44 changes: 44 additions & 0 deletions README-ssh.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,47 @@ nginx -t
systemctl restart nginx
systemctl reload nginx

## Nginx Config
cd etc/nginx/sites-available/
nano default

```
map $query_string $proxy_host {
"~^url=(.*)" $1;
default $query_string;
}
server {
listen 443 ssl;
server_name a11y.neofonie.de;
root /var/www/html;
index index.html;
ssl_certificate /etc/ssl/neofonie/fullchain.pem;
ssl_certificate_key /etc/ssl/neofonie/privkey.pem;
# a11y.neofonie.de/cors-hirse?url=google.com
location /cors-ng {
rewrite ^/cors-ng(.*) /$1 break;
resolver 8.8.8.8 valid=1h;
proxy_pass https://$proxy_host;
}
location /cors-js {
rewrite ^/cors-js(.*) /$1 break;
proxy_pass_request_headers on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://a11y.neofonie.de:8443/https://$proxy_host;
}
location /cors {
proxy_pass http://a11y.neofonie.de:1337;
}
}
```
9 changes: 8 additions & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ sftp
passphrase: secrets.passphrase,
privateKey: Buffer.from(secrets.privateKey.replace(/\|/g, "\n"), "utf-8"),
})
.then(() => sftp.uploadDir(src, secrets.destination))
.then(() => {
// cleanup svelte dir
return sftp.rmdir(secrets.destination + "/_app", true);
})
.then(() => {
// upload new vite
return sftp.uploadDir(src, secrets.destination);
})
.then((msg: string) => {
console.log("Upload done", msg);
return sftp.end();
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/a11y-inspector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
function loadPagePerProxy() {
if (src && elmIframe) {
fetch(proxy + src)
.then((response) => response.text())
.then((rawHTML) => {
elmIframe.src = `data:text/html;charset=utf-8,${escape(rawHTML)}`;
.then((response) => response.json())
.then((json) => {
elmIframe.src = `data:text/html;charset=utf-8,${escape(json.html)}`;
if (DOMParser) {
const parser = new DOMParser(),
doc = parser.parseFromString(rawHTML, 'text/html');
doc = parser.parseFromString(json.html, 'text/html');
watchedA11yContent(doc);
testA11yRules();
Expand Down

0 comments on commit 4a34e55

Please sign in to comment.