- Python 93.8%
- Makefile 6.2%
| .vscode | Fetch codeberg's swagger api json if needed | |
| fourgy | Fetch codeberg's swagger api json if needed | |
| .gitignore | Fetch codeberg's swagger api json if needed | |
| 4gDirectory.org | Add 4g's home directory | |
| LICENSE | Relicense 4g under LGPL over GPL | |
| package | Add some convenient symlinks | |
| README.md | Update README on mfs use | |
| typos.toml | Simplify names in 4g | |
4g
Forgy, the forge client
Forge requests using morph fs
each request will be stored as virtual file Requesst types as GET, DELETE, PUT and so on will be treated as file types.
Known Forgejo's API Request stored in Json file but Morph allows to get its content
[repoGet]
type = forgejo/api
fullname = Get a Repository
# Filetypes wont be stored exactly here, but close enough
filetype = Morph Config
# Operations reuse other morph files
# opearation is type of morph string and reads here a values from 2 morph configs
operation = /repos/{forgejo/@/owner}/{forgejo/@/repo}
# Since this is a regular config, you have to specify variable types inside external variable
# In our case we just list what variables should be treated as Morph Format Strings
morphs = operation
operationId = repoGet
[repoGet.responses]
# Morph configs dont support dictionaries, but allows Sectors (like in .ini and .desktop)
# Morph Configs are stored in python dicts, and point in sector's name allows to add sub dicts
202 = empty
403 = forbidden
404 = notFound
[repoGet.parameters]
## Alternatively, you can skip Sectors by using full-path of the end objects
## When fullpath is not used variables are stored in current sector (repoGet.parameters rn)
repoGet.responses.202 = empty
repoGet.responses.403 = forbidden
repoGet.responses.404 = notFound
Known Forgejo's API Request stored in json but used from Morph:
{
"forgejo/api/Get a Repository": {
# Filetypes wont be stored exactly here, but close enough
"filetype": "Json",
# Operations reuse other morph files
"operation": "/repos/{forgejo/@/owner}/{forgejo/@/repo}",
# Since this is a regular config, you have to specify variable types inside external variable
# In our case we just list what variables should be treated as Morph Format Strings
"morphs": "operation",
"operationId": "repoGet",
"responses": {
"202": "empty",
"403": "forbidden",
"404": "notFound"
},
"parameters": {}
}
}
to get responces you just use this syntax (regardless of filetype):
forgejo.api/api/Get a Repository/@/responses.202
Note: after mfs alpha version, this json will get split into at least 2 different jsons or more.
Mfs treats its file nodes as files
The forgejo/api/Get a Repository is a file,
when forgejo.mcf/@/repo is a variable from forgejo morph config.
/@/ is not a directory inside a file, it is just a filename exception that redirects from file to its content.
When . is current directory, .. for parental, ... in morph fs is for inner directory inside file.
... allows you to treat file's nodes as files and work with all metadata as files (sometimes even configs).
Mfs will work with node's fields if it's type is either .mcf (morph config) or json (for now).
MFS' any kind of metadata is easily accessible
To change owner of the file inside mfs you just gotta:
mfs["my-file.txt/.../metadata/owner"] = "tux"
To redirect symbobolic file try this:
mfs["my-symblink/.../symlinks/file"] = "/dev/null"
Even tho it may seem as anyone can have access to anything and break anything they want, it is not the case. The nodes in filesystem are protected by hash, and some metadata is locked and/or does not allow changing hash. Virstual FS provides simple access, but prevents breaks.