# Yesterweb connection with WebDAV

For some reasons, official page with WebDAV connection details is not available anymore
=> https://gemini.yesterweb.org/welcome.gmi

Just created this note as the alternative to WebArchive, plus few additional notes below:

```
Hostname: cities.yesterweb.org
Port: 1994
Encryption: SSL/TLS (davs://)
Username and Password are the same as the ones you just set
```

* username must be lowercase

## Nautilus

Nautilus is default file manager in the GNOME desktop environment, with native WebDAV support.

### Multi-account sessions

If you own multiple accounts on Yesterweb, the auth manager would cache previous login session.
To reset it, just run following command in the terminal from the current user:

``` bash
gnome-keyring-daemon -r
```

then, re-connect with the new account credentials.

### Keyring auth issues

If accessing the keyring fails with error like:

> The password you use to log in to your computer no longer matches that of your login keyring

just drop this file and try unlock it again:

``` bash
rm ~/.local/share/keyrings/login.keyring
```

## VSCode

Manual file uploads are not always useful.
It is much better to sync recent changes directly from the editor by using WebDAV extension.

### WebDAV Upload (original)

1. In the VSCode, it should be available from extensions; in the VSCodium, install using VSIX file:

=> https://marketplace.visualstudio.com/items?itemName=jorithvdheuvel.webdav VisualStudio Marketplace

2. Create configuration file in the project root:

``` /webdav.json
{
    "/public": {
        "url": "https://cities.yesterweb.org:1994/",
        "ignoreSSLErrors": true
    }
}
```
* to use multiple keyring credentials from different VSCode projects, append the username in subdomain
* to prevent sensitive data uploads by mistake - keep system files like `.vscode`, `.git`, `webdav.json`, etc in the project root; while public ones - in the `/public` folder

3. Open file to upload in the editor then enter:

```
Ctrl+Shift+P
```
* it is important to open any file in the editor before run this command, to handle uploading target properly

4. Enter Yesterweb login/password (on first connection)

5. Select the operation from list:

* WebDAV: Compare with remote WebDAV
* WebDAV: Upload to remote WebDAV

### WebDAV Upload fork by YGGverse

Official extension does not implement following features:

* remote file directory auto-create
* auto-upload file on save
* filename patterns to upload

even pushed some PRs into the official repository,
to not await for merge, simply use this fork (YGGverse branch)

Also take a look on additional config options:

``` /webdav.json
{
    "/public": {
        "url": "https://cities.yesterweb.org:1994/",
        "ignoreSSLErrors": true,
        "uploadOnSave": {
            "enabled": true,
            "pattern": [
                ".gmi$"
            ]
        }
    }
}
```

=> https://github.com/YGGverse/vscode-webdav#build-from-sources Source on GitHub (with build instructions)

### LSAF Rest API for WebDAV Upload

Recently found yet another fork of the extension above.

I haven't tried whether Yesterweb really supports it or what is included in this fork,
but the development of this project appears to be quite active, so it is worth checking out:

=> https://github.com/jbodart-argenx/vscode-lsaf-restapi-upload Source on GitHub

### Bash script

Finally, I've switched to the following script, which:

* Commits changes to the CVS repository
* Creates a .zip archive to download the entire capsule
* Uploads changed files to a local server via SFTP (accessible through Yggdrasil and I2P)
* Uploads changed files to Yesterweb hosting via WebDAV

``` sync.sh
#!/bin/bash

SRC="public"
ZIP="ps.zip"

echo "snap $SRC > $ZIP ..."
cd $SRC
rm $ZIP
zip -r -9 $ZIP ./
cd ../

echo "update repository ..."
git pull
git add .
git commit -m "$(date +%s)"
git push

echo "update remote host (localnet) ..."
rclone sync $SRC localnet:public --update -v

echo "update remote host (yesterweb) ..."
rclone sync $SRC yesterweb:/ --update --no-check-certificate -v
```