openidec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

README.md (5049B)


      1 # Intro
      2 
      3 OpenIDEC is [idec](https://github.com/idec-net/new-docs/blob/master/main.md) node realization written in golang.
      4 
      5 Forked from https://github.com/hugeping/ii-go for OpenBSD adaptation
      6 
      7 It has no dependencies and very compact. You can easy setup it and make your own ii/idec node.
      8 
      9 How to build?
     10 
     11 ```
     12 git clone https://git.openbsd.org.ru/vasyahacker/openidec.git
     13 cd openidec
     14 make build
     15 ```
     16 
     17 # idecctl
     18 
     19 idecctl can be used to fetch messages from another node and maintaince database.
     20 
     21 ## Fetch messages
     22 
     23 idecctl [options] fetch [uri] [echolist]
     24 
     25 echolist is the file with echonames (can has : splitted columns, like list.txt) or - -- to load it from stdin. For example:
     26 
     27 ```
     28 echo "std.club:this comment will be omitted" | ./idecctl fecth http://127.0.0.1:8080 -
     29 ```
     30 
     31 Options are:
     32 
     33 ```
     34 -db <database>   -- db by default (db.idx - genetated index)
     35 -lim=<n>         -- fetch mode, if omitted full sync will be performed if needed
     36                     if n > 0 - last n messages synced
     37                     if n < 0 - adaptive fetching with step n will be performed
     38 -f               -- do not check last message, perform sync even it is not needed
     39 ```
     40 
     41 If echolist is omitted, fetcher will try to get all echos. It uses list.txt extension of IDEC if target node supports it.
     42 
     43 ## Create index
     44 
     45 Index file (db.idx by default) is created when needed. If you want force to recreate it, use:
     46 
     47 ```
     48 ./idecctl index
     49 ```
     50 
     51 ## Store bundle into db
     52 
     53 DB is just msgid:message bundles in base64 stored in text file. You can merge records from db to db with store command:
     54 
     55 ```
     56 idecctl [options] store [db]
     57 ```
     58 db - is file with bundles or '-' for stdin.
     59 
     60 Options are:
     61 
     62 ```
     63 -db <database> -- db to store/merge in;
     64 ```
     65 ## Show messages
     66 
     67 Messages are identificated by unique message ids (MsgId). It is the first column in bundle:
     68 
     69 ```
     70 <msgid>:<message>
     71 ```
     72 
     73 You may select messages with select cmd:
     74 
     75 ```
     76 ./idecctl [options] select <echo.name> [slice]
     77 ```
     78 
     79 slice is the start:limit. For example:
     80 
     81 ```
     82 ./idecctl select std.club -1:1 # get last message
     83 ./idecctl select std.club 0:10 # get first 10 messages
     84 ```
     85 Options are:
     86 
     87 ```
     88 -from <user>   -- from user
     89 -to <user>     -- to user
     90 -t             -- only topics (w/o repto)
     91 -db <database> -- db by default (db.idx - genetated index)
     92 -v             -- show message text, not only MsgId
     93 ```
     94 
     95 You may show selected message:
     96 
     97 ```
     98 ./idecctl [options] get <MsgId>
     99 ```
    100 
    101 Or search message:
    102 
    103 ```
    104 ./idecctl [options] search <string> [echo]
    105 ```
    106 
    107 Where options are:
    108 
    109 ```
    110 -db <database> -- db by default (db.idx - genetated index)
    111 -v             -- show message text, not only MsgId
    112 ```
    113 You can sort ids by date with sort command.
    114 
    115 To show last 5 messages adressed to selected user, try:
    116 
    117 ```
    118 ./idecctl [options] -to <user> select "" | ./idecctl sort | tail -n5 | ./idecctl -v sort
    119 ```
    120 For example:
    121 
    122 ```
    123 ./idecctl -v -to Peter "" -1:1 # show and print last message to Peter
    124 ```
    125 
    126 ## Add user (point)
    127 
    128 ```
    129 ./idecctl [-u pointfile] useradd <name> <e-mail> <password>
    130 ```
    131 **Attention**: by default, a new user is added blocked, **set 'locked/no' in points.txt to unlock**
    132 
    133 By default, pointfile is points.txt
    134 
    135 ## Blacklist msg
    136 
    137 ```
    138 ./idecctl [-db db] blacklist <MsgId>
    139 ```
    140 Blacklist is just new record with same id but spectial status.
    141 
    142 # idecd
    143 
    144 To run node:
    145 
    146 ```
    147 ./idecd [options]
    148 ```
    149 Where options are:
    150 
    151 ```
    152 -L               Listen address, default is :8080
    153 -db <path>       Database, "db" by default
    154 -e list          Echos list file. This file needs only for descriptions
    155                  and must be in list.txt format, where 2nd colum is ignored.
    156                  When this file is exists, points can not create they own echos.
    157                  list.txt by default.
    158 -host <string>   Host string for node. For ex. http://hugeping.tk.
    159                  http://127.0.0.1:8080 by default
    160 -noreg Disable new users registration
    161 -style path      Path to /style web-directory (css/images) (default "./style")
    162 -sys "name"      Node name. "openidec" by default
    163 -tpl path        Path to html templates (default "./tpl")
    164 -u <points>      Points file. "points.txt" by default.
    165 -v               Be verbose (for tracing)
    166 ```
    167 ## Example setup
    168 
    169 ```
    170 ./idecctl fetch http://club.syscall.ru
    171 wget http://club.syscall.ru/list.txt # for echo descriptions
    172 ./idecd -sys "newnode" -tpl www/tpl -style www/style
    173 ```
    174 And open http://127.0.0.1:8080 in your browser.
    175 
    176 **Attention**: by default, a new user is added blocked, **set 'locked/no' in points.txt to unlock**
    177 
    178 ## Standarts supported
    179 
    180 - u/e
    181 - list.txt
    182 - x/c
    183 - blacklist.txt
    184 - m/
    185 - e/
    186 
    187 ## Limitations
    188 
    189 Size of message can not be greater then 65536 bytes (before encoded into base64).
    190 
    191 # web interface
    192 
    193 User with id 1 (first created user) is admin.
    194 Admin can create new echoes with: http://127.0.0.1:8080/new
    195 Another hiden feature, is blacklisting: http://127.0.0.1:8080/msgid/blacklist
    196 
    197 Web interface supports some non-standart features in message body text:
    198 
    199 - @spolier: spoiler
    200 - @base64: name (base64 data from next line till end of message)
    201 - xpm2 and xpm3 images embedding
    202 
    203 That's all, for now! :)