yggverse
9 months ago
11 changed files with 540 additions and 0 deletions
@ -0,0 +1,60 @@ |
|||||||
|
# β-Doku is DokuWiki Satellite for Gemini Protocol |
||||||
|
|
||||||
|
Allows to launch read-only DokuWiki proxy server |
||||||
|
|
||||||
|
It is based on titan-II server, gemini-php to parse DokuWiki data folder, cache-php to save compiled pages in memory and Manticore for full-text search. |
||||||
|
|
||||||
|
## Examples |
||||||
|
|
||||||
|
=> gemini://betahowto.duckdns.org Clearnet instance of Yggdrasil Wiki (http://[222:a8e4:50cd:55c:788e:b0a5:4e2f:a92c]) |
||||||
|
=> gemini://[301:23b4:991a:634d::b] Yggdrasil mirror |
||||||
|
=> gemini://betahowto.ygg Alfis DNS alias |
||||||
|
|
||||||
|
## Install |
||||||
|
|
||||||
|
``` |
||||||
|
wget https://repo.manticoresearch.com/manticore-repo.noarch.deb |
||||||
|
dpkg -i manticore-repo.noarch.deb |
||||||
|
apt update |
||||||
|
apt install git composer memcached manticore manticore-extra php-fpm php-memcached php-mysql php-mbstring |
||||||
|
git clone https://github.com/YGGverse/bdoku.git |
||||||
|
cd bdoku |
||||||
|
composer update |
||||||
|
``` |
||||||
|
|
||||||
|
## Setup |
||||||
|
|
||||||
|
``` |
||||||
|
cd bdoku |
||||||
|
mkdir host/127.0.0.1 |
||||||
|
cp example/config.json host/127.0.0.1/config.json |
||||||
|
cd host/127.0.0.1 |
||||||
|
openssl req -x509 -newkey rsa:4096 -keyout key.rsa -out cert.pem -days 365 -nodes -subj "/CN=127.0.0.1" |
||||||
|
``` |
||||||
|
|
||||||
|
## Launch |
||||||
|
|
||||||
|
Before launch the server, copy or create alias of path/to/dokuwiki/data folder to bdoku/host/127.0.0.1 on example above. |
||||||
|
|
||||||
|
On every start, previous memory cache will be cleaned and new search index created. |
||||||
|
After data folder update, you need just to restart your server with systemd or another process manager. |
||||||
|
|
||||||
|
When launching with systemd, just make sure that manticore server already running: |
||||||
|
|
||||||
|
``` |
||||||
|
[Unit] |
||||||
|
Wants=manticore.service |
||||||
|
After=manticore.service |
||||||
|
... |
||||||
|
``` |
||||||
|
|
||||||
|
Then |
||||||
|
``` |
||||||
|
php src/server.php 127.0.0.1 |
||||||
|
``` |
||||||
|
|
||||||
|
Open gemini://127.0.0.1 in your favorite Gemini browser! |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/bdoku β-Doku on GitHub |
@ -0,0 +1,12 @@ |
|||||||
|
# YGGverse - News |
||||||
|
|
||||||
|
=> release-gemini-php-0.7.0.gmi 2024-04-07 Release gemini-php 0.7.0 |
||||||
|
=> release-gemini-php-0.6.0.gmi 2024-04-06 Release gemini-php 0.6.0 |
||||||
|
=> release-gemini-php-0.5.0.gmi 2024-04-05 Release gemini-php 0.5.0 |
||||||
|
=> release-gemini-php-0.4.1.gmi 2024-04-05 Release gemini-php 0.4.1 |
||||||
|
=> release-gemini-php-0.4.0.gmi 2024-04-03 Release gemini-php 0.4.0 |
||||||
|
=> yo-search-for-gemini-protocol.gmi 2024-04-03 Yo! search branch for Gemini Protocol |
||||||
|
=> release-gemini-php-0.3.0.gmi 2024-04-03 Release gemini-php 0.3.0 |
||||||
|
=> release-gemini-php-0.2.0.gmi 2024-04-02 Release gemini-php 0.2.0 |
||||||
|
=> release-gemini-php-0.1.0.gmi 2024-04-02 Release gemini-php 0.1.0 |
||||||
|
=> bdoku-dokuwiki-satellite-for-gemini-protocol.gmi 2024-01-30 β-Doku is DokuWiki Satellite for Gemini Protocol |
@ -0,0 +1,219 @@ |
|||||||
|
# Release gemini-php 0.1.0 |
||||||
|
|
||||||
|
Initial release dedicated to β-Doku project |
||||||
|
|
||||||
|
At this point, toolkit provides DokuWiki API for Gemini protocol |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
### Reader |
||||||
|
|
||||||
|
Read DokuWiki and convert to Gemini |
||||||
|
|
||||||
|
``` php |
||||||
|
$reader = new \Yggverse\Gemini\Dokuwiki\Reader( |
||||||
|
// optional regex rule set array |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Get or change existing regex rule (or just skip by using build-in set) |
||||||
|
|
||||||
|
``` php |
||||||
|
echo $reader->setRule( |
||||||
|
'/subject/ui', |
||||||
|
'replacement' |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Convert DokuWiki text to Gemini markup |
||||||
|
|
||||||
|
As wiki has lot of inline links, to make converted document well-readable, this method does not replace links with new line => macros, but uses inline context: Name ( URL ). |
||||||
|
|
||||||
|
This model useful with Reader::getLinks method, that for example appends all those related links to the document footer. |
||||||
|
|
||||||
|
If you don't like this implementation, feel free to change it by Reader::setRule method! |
||||||
|
|
||||||
|
``` php |
||||||
|
echo $reader->toGemini( |
||||||
|
file_get_contents( |
||||||
|
'/host/data/pages/index.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Get document title |
||||||
|
|
||||||
|
``` php |
||||||
|
$gemini = $reader->toGemini( |
||||||
|
file_get_contents( |
||||||
|
'/host/data/pages/index.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
echo $reader->getH1( |
||||||
|
$gemini |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Get document links |
||||||
|
|
||||||
|
``` php |
||||||
|
$gemini = $reader->toGemini( |
||||||
|
file_get_contents( |
||||||
|
'/host/data/pages/index.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
echo $reader->getLinks( |
||||||
|
$gemini |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
### Filesystem |
||||||
|
|
||||||
|
Provides methods for simple and secure interaction with DokuWiki file storage |
||||||
|
|
||||||
|
``` php |
||||||
|
$filesystem = new \Yggverse\Gemini\Dokuwiki\Filesystem( |
||||||
|
'/host/data' // storage location |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return simple array of all files in storage |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getList( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return all files under the storage folder in tree format |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getTree( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return pages under the given data directory |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getPagePathsByPath( |
||||||
|
// absolute path to target data directory (e.g. Filesystem::getDirectoryPathByUri) |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return absolute path to stored page file |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getPagePathByUri( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return page URI in dokuwiki:format |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getPageUriByPath( |
||||||
|
'/full/path/to/page.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return absolute path to stored media file |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getMediaPathByUri( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return file MIME if path match storage item |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getMimeByPath( |
||||||
|
'/full/path/to/page.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return file content if path match storage item |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->getDataByPath( |
||||||
|
'/full/path/to/page.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Check path exist and match storage item |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$filesystem->isPath( |
||||||
|
'/full/path/to/page.txt' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
### Helper |
||||||
|
|
||||||
|
Useful methods to minify controller codebase |
||||||
|
|
||||||
|
``` php |
||||||
|
$helper = new \Yggverse\Gemini\Dokuwiki\Helper( |
||||||
|
new \Yggverse\Gemini\Dokuwiki\Filesystem(), |
||||||
|
new \Yggverse\Gemini\Dokuwiki\Reader() |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return simple array of children section links in Gemini format |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$helper->getChildrenSectionLinksByUri( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return simple array of children page links in Gemini format |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$helper->getChildrenPageLinksByUri( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Return page link (that contain document name) in Gemini format |
||||||
|
|
||||||
|
``` php |
||||||
|
var_dump ( |
||||||
|
$helper->getPageLinkByPath( |
||||||
|
$filesystem->getPagePathByUri( |
||||||
|
'hello:world' |
||||||
|
) |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.1.0 Download gemini-php 0.1.0 |
||||||
|
=> https://github.com/YGGverse/gemini-php#dokuwiki API documentation |
||||||
|
=> bdoku-dokuwiki-satellite-for-gemini-protocol.gmi β-Doku is DokuWiki Satellite for Gemini Protocol |
@ -0,0 +1,26 @@ |
|||||||
|
# Release gemini-php 0.2.0 |
||||||
|
|
||||||
|
Completed Request / Response Client |
||||||
|
|
||||||
|
This API make TLS socket connection simpler for PHP apps based on Composer |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org:1965/index.gmi' |
||||||
|
); |
||||||
|
|
||||||
|
$response = new \Yggverse\Gemini\Client\Response( |
||||||
|
$request->getResponse() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$response->getBody() |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.2.0 Download gemini-php 0.2.0 |
||||||
|
=> https://github.com/YGGverse/Yo/blob/gemini/src/cli/document/crawl.php Feature in Yo! Crawler branch for Gemini Protocol |
@ -0,0 +1,55 @@ |
|||||||
|
# Release gemini-php 0.3.0 |
||||||
|
|
||||||
|
Version 0.3.0 is here! |
||||||
|
|
||||||
|
Includes new classes for object-oriented work with gemtext (text/gemini) |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org' |
||||||
|
); |
||||||
|
|
||||||
|
$response = new \Yggverse\Gemini\Client\Response( |
||||||
|
$request->getResponse() |
||||||
|
); |
||||||
|
|
||||||
|
$body = new \Yggverse\Gemini\Gemtext\Body( |
||||||
|
$response->getBody() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$body->getH2() |
||||||
|
); |
||||||
|
|
||||||
|
foreach ($body->getLinks() as $line) |
||||||
|
{ |
||||||
|
$link = new \Yggverse\Gemini\Gemtext\Link( |
||||||
|
$line |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$link->getAddress() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$link->getAlt() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$link->getDate( |
||||||
|
$timestamp // get unix time from this variable |
||||||
|
) |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$timestamp |
||||||
|
); |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.3.0 Download gemini-php 0.3.0 |
||||||
|
=> https://github.com/YGGverse/gemini-php?tab=readme-ov-file#gemtext Gemtext API methods |
@ -0,0 +1,36 @@ |
|||||||
|
# Release gemini-php 0.4.0 |
||||||
|
|
||||||
|
Includes Body::findLinks method to grab clickable links from Gemtext |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org' |
||||||
|
); |
||||||
|
|
||||||
|
$response = new \Yggverse\Gemini\Client\Response( |
||||||
|
$request->getResponse() |
||||||
|
); |
||||||
|
|
||||||
|
$body = new \Yggverse\Gemini\Gemtext\Body( |
||||||
|
$response->getBody() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$body->findLinks() // returns array of gemini links |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$body->findLinks('http') // returns array of http links |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
## Other |
||||||
|
|
||||||
|
* add response setters |
||||||
|
* reduce default chunk size |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.4.0 Download gemini-php 0.4.0 |
@ -0,0 +1,14 @@ |
|||||||
|
# Release gemini-php 0.4.1 |
||||||
|
|
||||||
|
Correction release |
||||||
|
|
||||||
|
* allow nullable $length attribute |
||||||
|
* remove chunk settings |
||||||
|
* remove custom length value |
||||||
|
* allow nullable response init |
||||||
|
* fix macros name |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.4.1 Download gemini-php 0.4.1 |
||||||
|
=> release-gemini-php-0.4.0.gmi Major version details |
@ -0,0 +1,36 @@ |
|||||||
|
# Release gemini-php 0.5.0 |
||||||
|
|
||||||
|
Implemented Body::skipTags filter |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org' |
||||||
|
); |
||||||
|
|
||||||
|
$response = new \Yggverse\Gemini\Client\Response( |
||||||
|
$request->getResponse() |
||||||
|
); |
||||||
|
|
||||||
|
$body = new \Yggverse\Gemini\Gemtext\Body( |
||||||
|
$response->getBody() |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$body->skipTags() // strip all tags |
||||||
|
); |
||||||
|
|
||||||
|
var_dump( |
||||||
|
$body->skipTags( |
||||||
|
[ // strip 1- and 2- level headers only |
||||||
|
"##", |
||||||
|
"###" |
||||||
|
] |
||||||
|
) |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.5.0 Download gemini-php 0.5.0 |
@ -0,0 +1,28 @@ |
|||||||
|
# Release gemini-php 0.6.0 |
||||||
|
|
||||||
|
Add stream context options support |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org', |
||||||
|
'68.133.1.71' // make direct request to the resolved host |
||||||
|
); |
||||||
|
|
||||||
|
$request->setOptions( |
||||||
|
[ |
||||||
|
'ssl' => |
||||||
|
[ |
||||||
|
'peer_name' => 'yggverse.cities.yesterweb.org', // SNI |
||||||
|
'verify_peer' => false, |
||||||
|
'verify_peer_name' => false |
||||||
|
] |
||||||
|
] |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.6.0 Download gemini-php 0.6.0 |
||||||
|
=> https://github.com/YGGverse/net-php Network Resolver in PHP 8 |
@ -0,0 +1,35 @@ |
|||||||
|
# Release gemini-php 0.7.0 |
||||||
|
|
||||||
|
Client::Request method now supports resolved host as optional argument! |
||||||
|
|
||||||
|
This feature useful to |
||||||
|
|
||||||
|
* reduce traffic usage |
||||||
|
* increase page loading time by DNS results cache in memory |
||||||
|
* alternative networks resolvers, isolated of system |
||||||
|
|
||||||
|
Update dedicated to the Yo! crawler project |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/Yo/tree/gemini |
||||||
|
|
||||||
|
## Example |
||||||
|
|
||||||
|
``` php |
||||||
|
$request = new \Yggverse\Gemini\Client\Request( |
||||||
|
'gemini://yggverse.cities.yesterweb.org:1965/index.gmi' // target URL |
||||||
|
'68.133.1.71' // resolved IP, skip to use system-wide resolver |
||||||
|
); |
||||||
|
``` |
||||||
|
|
||||||
|
Alternatively, use setResolvedHost method of Request object before getResponse |
||||||
|
|
||||||
|
``` php |
||||||
|
$request->setResolvedHost( |
||||||
|
'68.133.1.71' |
||||||
|
) |
||||||
|
``` |
||||||
|
|
||||||
|
## Links |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php/releases/tag/0.7.0 Download gemini-php 0.7.0 |
||||||
|
=> https://github.com/YGGverse/net-php Network Resolver in PHP 8 |
@ -0,0 +1,19 @@ |
|||||||
|
# Yo! search for Gemini Protocol |
||||||
|
|
||||||
|
Just created Yo! branch oriented for Gemini space |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/Yo/tree/gemini |
||||||
|
|
||||||
|
At this moment under development, we hope to launch online crawler soon. |
||||||
|
|
||||||
|
Yo! is the super thin client-server crawler based on Manticore full-text search server. |
||||||
|
|
||||||
|
It written in PHP 8 / Composer, includes flexible settings, page history snaps, CLI tools for administration and simple JS-less UI (in original build) |
||||||
|
|
||||||
|
Probably, Gemini interface will be implemented using Titan-II server fork with better IPv6 support (as we're from Yggdrasil) |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/titan-II |
||||||
|
|
||||||
|
Also, working on gemini-php library as the dependency: |
||||||
|
|
||||||
|
=> https://github.com/YGGverse/gemini-php |
Loading…
Reference in new issue