204 lines
4.9 KiB
Markdown
204 lines
4.9 KiB
Markdown
# Intro
|
|
|
|
OpenIDEC is [idec](https://github.com/idec-net/new-docs/blob/master/main.md) node realization written in golang.
|
|
|
|
Forked from https://github.com/hugeping/ii-go for OpenBSD adaptation
|
|
|
|
It has no dependencies and very compact. You can easy setup it and make your own ii/idec node.
|
|
|
|
How to build?
|
|
|
|
```
|
|
git clone https://git.openbsd.org.ru/vasyahacker/openidec.git
|
|
cd openidec
|
|
make build
|
|
```
|
|
|
|
# idecctl
|
|
|
|
idecctl can be used to fetch messages from another node and maintaince database.
|
|
|
|
## Fetch messages
|
|
|
|
idecctl [options] fetch [uri] [echolist]
|
|
|
|
echolist is the file with echonames (can has : splitted columns, like list.txt) or - -- to load it from stdin. For example:
|
|
|
|
```
|
|
echo "std.club:this comment will be omitted" | ./idecctl fecth http://127.0.0.1:8080 -
|
|
```
|
|
|
|
Options are:
|
|
|
|
```
|
|
-db <database> -- db by default (db.idx - genetated index)
|
|
-lim=<n> -- fetch mode, if omitted full sync will be performed if needed
|
|
if n > 0 - last n messages synced
|
|
if n < 0 - adaptive fetching with step n will be performed
|
|
-f -- do not check last message, perform sync even it is not needed
|
|
```
|
|
|
|
If echolist is omitted, fetcher will try to get all echos. It uses list.txt extension of IDEC if target node supports it.
|
|
|
|
## Create index
|
|
|
|
Index file (db.idx by default) is created when needed. If you want force to recreate it, use:
|
|
|
|
```
|
|
./idecctl index
|
|
```
|
|
|
|
## Store bundle into db
|
|
|
|
DB is just msgid:message bundles in base64 stored in text file. You can merge records from db to db with store command:
|
|
|
|
```
|
|
idecctl [options] store [db]
|
|
```
|
|
db - is file with bundles or '-' for stdin.
|
|
|
|
Options are:
|
|
|
|
```
|
|
-db <database> -- db to store/merge in;
|
|
```
|
|
## Show messages
|
|
|
|
Messages are identificated by unique message ids (MsgId). It is the first column in bundle:
|
|
|
|
```
|
|
<msgid>:<message>
|
|
```
|
|
|
|
You may select messages with select cmd:
|
|
|
|
```
|
|
./idecctl [options] select <echo.name> [slice]
|
|
```
|
|
|
|
slice is the start:limit. For example:
|
|
|
|
```
|
|
./idecctl select std.club -1:1 # get last message
|
|
./idecctl select std.club 0:10 # get first 10 messages
|
|
```
|
|
Options are:
|
|
|
|
```
|
|
-from <user> -- from user
|
|
-to <user> -- to user
|
|
-t -- only topics (w/o repto)
|
|
-db <database> -- db by default (db.idx - genetated index)
|
|
-v -- show message text, not only MsgId
|
|
```
|
|
|
|
You may show selected message:
|
|
|
|
```
|
|
./idecctl [options] get <MsgId>
|
|
```
|
|
|
|
Or search message:
|
|
|
|
```
|
|
./idecctl [options] search <string> [echo]
|
|
```
|
|
|
|
Where options are:
|
|
|
|
```
|
|
-db <database> -- db by default (db.idx - genetated index)
|
|
-v -- show message text, not only MsgId
|
|
```
|
|
You can sort ids by date with sort command.
|
|
|
|
To show last 5 messages adressed to selected user, try:
|
|
|
|
```
|
|
./idecctl [options] -to <user> select "" | ./idecctl sort | tail -n5 | ./idecctl -v sort
|
|
```
|
|
For example:
|
|
|
|
```
|
|
./idecctl -v -to Peter "" -1:1 # show and print last message to Peter
|
|
```
|
|
|
|
## Add user (point)
|
|
|
|
```
|
|
./idecctl [-u pointfile] useradd <name> <e-mail> <password>
|
|
```
|
|
**Attention**: by default, a new user is added blocked, **set 'locked/no' in points.txt to unlock**
|
|
|
|
By default, pointfile is points.txt
|
|
|
|
## Blacklist msg
|
|
|
|
```
|
|
./idecctl [-db db] blacklist <MsgId>
|
|
```
|
|
Blacklist is just new record with same id but spectial status.
|
|
|
|
# idecd
|
|
|
|
To run node:
|
|
|
|
```
|
|
./idecd [options]
|
|
```
|
|
Where options are:
|
|
|
|
```
|
|
-L Listen address, default is :8080
|
|
-db <path> Database, "db" by default
|
|
-e list Echos list file. This file needs only for descriptions
|
|
and must be in list.txt format, where 2nd colum is ignored.
|
|
When this file is exists, points can not create they own echos.
|
|
list.txt by default.
|
|
-host <string> Host string for node. For ex. http://hugeping.tk.
|
|
http://127.0.0.1:8080 by default
|
|
-noreg Disable new users registration
|
|
-style path Path to /style web-directory (css/images) (default "./style")
|
|
-sys "name" Node name. "openidec" by default
|
|
-tpl path Path to html templates (default "./tpl")
|
|
-u <points> Points file. "points.txt" by default.
|
|
-v Be verbose (for tracing)
|
|
```
|
|
## Example setup
|
|
|
|
```
|
|
./idecctl fetch http://club.syscall.ru
|
|
wget http://club.syscall.ru/list.txt # for echo descriptions
|
|
./idecd -sys "newnode" -tpl www/tpl -style www/style
|
|
```
|
|
And open http://127.0.0.1:8080 in your browser.
|
|
|
|
**Attention**: by default, a new user is added blocked, **set 'locked/no' in points.txt to unlock**
|
|
|
|
## Standarts supported
|
|
|
|
- u/e
|
|
- list.txt
|
|
- x/c
|
|
- blacklist.txt
|
|
- m/
|
|
- e/
|
|
|
|
## Limitations
|
|
|
|
Size of message can not be greater then 65536 bytes (before encoded into base64).
|
|
|
|
# web interface
|
|
|
|
User with id 1 (first created user) is admin.
|
|
Admin can create new echoes with: http://127.0.0.1:8080/new
|
|
Another hiden feature, is blacklisting: http://127.0.0.1:8080/msgid/blacklist
|
|
|
|
Web interface supports some non-standart features in message body text:
|
|
|
|
- @spolier: spoiler
|
|
- @base64: name (base64 data from next line till end of message)
|
|
- xpm2 and xpm3 images embedding
|
|
|
|
That's all, for now! :)
|