1
0
Fork
You've already forked 4g
0
Forgy, the forge client
  • Python 93.8%
  • Makefile 6.2%
Find a file
2026年07月11日 23:27:01 +02:00
.vscode Fetch codeberg's swagger api json if needed 2026年07月11日 23:27:01 +02:00
fourgy Fetch codeberg's swagger api json if needed 2026年07月11日 23:27:01 +02:00
.gitignore Fetch codeberg's swagger api json if needed 2026年07月11日 23:27:01 +02:00
4gDirectory.org Add 4g's home directory 2026年05月20日 14:26:39 +02:00
LICENSE Relicense 4g under LGPL over GPL 2026年05月10日 10:44:33 +02:00
package Add some convenient symlinks 2026年07月11日 23:25:52 +02:00
README.md Update README on mfs use 2026年05月10日 20:02:43 +02:00
typos.toml Simplify names in 4g 2026年06月11日 04:11:05 +02:00

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.