Rebranding to OpenIDEC =)

pull/1/head
vasyahacker 2023-03-28 14:33:58 +04:00
parent f3b735a71c
commit 3771b9f7f6
15 changed files with 85 additions and 101 deletions

View File

@ -5,16 +5,16 @@ all: build
build-all: build
build:
go build -trimpath -o ii-tool ./cmd/ii-tool
go build -trimpath -o ii-node ./cmd/ii-node
go build -trimpath -o ii-gemini ./cmd/ii-gemini
go build -trimpath -o idecctl ./cmd/idecctl
go build -trimpath -o idecd ./cmd/idecd
go build -trimpath -o idecgmi ./cmd/idecgmi
install-all: install
install:
go install ./cmd/ii-tool
go install ./cmd/ii-node
go install ./cmd/ii-gemini
go install ./cmd/idecctl
go install ./cmd/idecd
go install ./cmd/idecgmi
clean:
rm -f ii-node ii-tool ii-gemini
rm -f idecd idecctl idecgmi

View File

@ -1,32 +1,31 @@
# Intro
II-GO is [idec](https://github.com/idec-net/new-docs/blob/master/main.md) node realization written in golang.
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://github.com/hugeping/ii-go
cd ii-go
cd ii-tool
go build
cd ../ii-node
go build
git clone https://git.openbsd.org.ru/vasyahacker/openidec.git
cd openidec
make build
```
# ii-tool
# idecctl
ii-tool can be used to fetch messages from another node and maintaince database.
idecctl can be used to fetch messages from another node and maintaince database.
## Fetch messages
ii-tool [options] fetch [uri] [echolist]
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" | ./ii-tool fecth http://127.0.0.1:8080 -
echo "std.club:this comment will be omitted" | ./idecctl fecth http://127.0.0.1:8080 -
```
Options are:
@ -46,7 +45,7 @@ If echolist is omitted, fetcher will try to get all echos. It uses list.txt exte
Index file (db.idx by default) is created when needed. If you want force to recreate it, use:
```
./ii-tool index
./idecctl index
```
## Store bundle into db
@ -54,7 +53,7 @@ Index file (db.idx by default) is created when needed. If you want force to recr
DB is just msgid:message bundles in base64 stored in text file. You can merge records from db to db with store command:
```
ii-tool [options] store [db]
idecctl [options] store [db]
```
db - is file with bundles or '-' for stdin.
@ -74,14 +73,14 @@ Messages are identificated by unique message ids (MsgId). It is the first column
You may select messages with select cmd:
```
./ii-tool [options] select <echo.name> [slice]
./idecctl [options] select <echo.name> [slice]
```
slice is the start:limit. For example:
```
./ii-tool select std.club -1:1 # get last message
./ii-tool select std.club 0:10 # get first 10 messages
./idecctl select std.club -1:1 # get last message
./idecctl select std.club 0:10 # get first 10 messages
```
Options are:
@ -96,13 +95,13 @@ Options are:
You may show selected message:
```
./ii-tool [options] get <MsgId>
./idecctl [options] get <MsgId>
```
Or search message:
```
./ii-tool [options] search <string> [echo]
./idecctl [options] search <string> [echo]
```
Where options are:
@ -116,18 +115,18 @@ You can sort ids by date with sort command.
To show last 5 messages adressed to selected user, try:
```
./ii-tool [options] -to <user> select "" | ./ii-tool sort | tail -n5 | ./ii-tool -v sort
./idecctl [options] -to <user> select "" | ./idecctl sort | tail -n5 | ./idecctl -v sort
```
For example:
```
./ii-tool -v -to Peter "" -1:1 # show and print last message to Peter
./idecctl -v -to Peter "" -1:1 # show and print last message to Peter
```
## Add user (point)
```
./ii-tool [-u pointfile] useradd <name> <e-mail> <password>
./idecctl [-u pointfile] useradd <name> <e-mail> <password>
```
By default, pointfile is points.txt
@ -135,16 +134,16 @@ By default, pointfile is points.txt
## Blacklist msg
```
./ii-tool [-db db] blacklist <MsgId>
./idecctl [-db db] blacklist <MsgId>
```
Blacklist is just new record with same id but spectial status.
# ii-node
# idecd
To run node:
```
./ii-node [options]
./idecd [options]
```
Where options are:
@ -157,18 +156,16 @@ Where options are:
list.txt by default.
-host <string> Host string for node. For ex. http://hugeping.tk.
http://127.0.0.1:8080 by default
-sys "name" Node name. "ii-go" by default
-sys "name" Node name. "openidec" by default
-u <points> Points file. "points.txt" by default.
-v Be verbose (for tracing)
```
## Example setup
```
cd ii-go/ii-node
ln -s ../ii-tool/ii-tool
./ii-tool fetch http://club.syscall.ru
./idecctl fetch http://club.syscall.ru
wget http://club.syscall.ru/list.txt # for echo descriptions
./ii-node -sys "newnode"
./idecd -sys "newnode"
```
And open http://127.0.0.1:8080 in your browser.

View File

@ -1,7 +1,7 @@
package main
import (
"git.openbsd.org.ru/vasyahacker/iigo/ii"
"git.openbsd.org.ru/vasyahacker/openidec/ii"
"bufio"
"flag"
"fmt"

View File

@ -1,7 +1,7 @@
package main
import (
"git.openbsd.org.ru/vasyahacker/iigo/ii"
"git.openbsd.org.ru/vasyahacker/openidec/ii"
"flag"
"fmt"
"html/template"
@ -57,7 +57,7 @@ func PointMsg(edb *ii.EDB, db *ii.DB, udb *ii.UDB, pauth string, tmsg string) st
var users_opt *string = flag.String("u", "points.txt", "Users database")
var db_opt *string = flag.String("db", "./db", "II database path (directory)")
var listen_opt *string = flag.String("L", ":8080", "Listen address")
var sysname_opt *string = flag.String("sys", "ii-go", "Node name")
var sysname_opt *string = flag.String("sys", "OpenIDEC", "Node name")
var host_opt *string = flag.String("host", "http://127.0.0.1:8080", "Node address")
var verbose_opt *bool = flag.Bool("v", false, "Verbose")
var echo_opt *string = flag.String("e", "list.txt", "Echoes list")
@ -101,7 +101,7 @@ func main() {
flag.Parse()
unix.Unveil("./tpl", "r")
unix.Unveil("/usr/local/share/iigo/tpl", "r")
unix.Unveil("/usr/local/share/openidec/tpl", "r")
unix.Unveil(*echo_opt, "r")
unix.Unveil(*users_opt, "rwc")
unix.Unveil(filepath.Dir(*db_opt), "rwc")
@ -254,13 +254,6 @@ func main() {
})
ii.Info.Printf("Listening on %s", *listen_opt)
// http.HandleFunc("hugeping.ru/", func(w http.ResponseWriter, r *http.Request) {
// http.Redirect(w, r, "//club.hugeping.ru/blog/std.hugeping", http.StatusSeeOther)
// })
// http.Handle("hugeping.ru/", http.FileServer(http.Dir("/home/pi/Devel/gemini/www")))
// http.Handle("syscall.ru/", http.FileServer(http.Dir("/home/pi/Devel/gemini/www")))
if err := http.ListenAndServe(*listen_opt, nil); err != nil {
ii.Error.Printf("Error running web server: %s", err)
}

View File

@ -1,7 +1,7 @@
package main
import (
"git.openbsd.org.ru/vasyahacker/iigo/ii"
"git.openbsd.org.ru/vasyahacker/openidec/ii"
"os"
"bytes"
"encoding/base64"
@ -915,8 +915,8 @@ func WebInit(www *WWW) {
tpl_path := "tpl"
if _, err := os.Stat(tpl_path); errors.Is(err, os.ErrNotExist) {
fmt.Println("./tpl not found, trying /usr/local/share/iigo/tpl..")
tpl_path = "/usr/local/share/iigo/tpl"
fmt.Println("./tpl not found, trying /usr/local/share/openidec/tpl..")
tpl_path = "/usr/local/share/openidec/tpl"
if _, err := os.Stat(tpl_path); errors.Is(err, os.ErrNotExist) {
fmt.Println(tpl_path, "not found")
os.Exit(1)

View File

@ -1,7 +1,7 @@
package main
import (
"git.openbsd.org.ru/vasyahacker/iigo/ii"
"git.openbsd.org.ru/vasyahacker/openidec/ii"
"bufio"
"flag"
"fmt"

8
go.mod
View File

@ -1,10 +1,4 @@
module git.openbsd.org.ru/vasyahacker/iigo
retract (
v1.0.0 // bad experiment.
v0.1.1 // bad experiment.
v0.1.0 // bad experiment.
)
module git.openbsd.org.ru/vasyahacker/openidec
go 1.18

View File

@ -53,7 +53,7 @@ type Index struct {
// Name: database name, 'db' by default.
// Sync: used to syncronize access to DB from goroutines (many readers, one writer).
// IdxSync: same, but for Index.
// LockDepth: used for recursive file lock, to avoid conflict between ii-tool and ii-node.
// LockDepth: used for recursive file lock, to avoid conflict between idecctl and idecd.
type DB struct {
Path string
Idx Index
@ -76,7 +76,7 @@ func append_file(fn string, text string) error {
return nil
}
// Recursive file lock. Used to avoid conflicts between ii-tool and ii-node.
// Recursive file lock. Used to avoid conflicts between idecctl and idecd.
// Uses mkdir as atomic operation.
// Note: dirs created as db.LockPath()
// 16 sec is limit.

View File

@ -57,7 +57,7 @@ func IsMsgId(id string) bool {
}
// Check if Echoarea is private area
// This is ii-go extension, echoareas
// This is openidec extension, echoareas
// that has "." prefix are for private messaging.
// Those areas can be fetched only with /u/point/auth/u/e/ scheme
func IsPrivate(e string) bool {

View File

@ -1,16 +1,16 @@
.TH ii-tool 1 "March 12, 2023" "version 0.0.1" "IIGO"
.TH idecctl 1 "March 12, 2023" "version 0.0.1" "OpenIDEC"
.SH NAME
.B ii-tool
.B idecctl
.SH SYNOPSIS
.B ii-tool
.B idecctl
[options] command [arguments]
.SH DESCRIPTION
.B ii-tool
.B idecctl
can be used to fetch messages from another node and maintaince database.
.SH OPTIONS
.TP
.B FETCH MESSAGES
.B ii-tool
.B idecctl
[options]
.B fetch
[uri] [echolist]
@ -35,15 +35,15 @@ It uses list.txt extension of IDEC if target node supports it.
.fi
.TP
.B CREATE INDEX
.B ii-tool
.B idecctl
index
.nf
Index file (db.idx by default) is created when needed.
If you want force to recreate it, use: ii-tool index
If you want force to recreate it, use: idecctl index
.fi
.TP
.B STORE BUNDLE INTO DB
.B ii-tool
.B idecctl
[options]
.B store
[DB]
@ -61,7 +61,7 @@ DB is just msgid:message bundles in base64 stored in text file.
.B SHOW MESSAGES
.nf
Select messages:
ii-tool [options] select <echo.name> [slice]
idecctl [options] select <echo.name> [slice]
slice is the start:limit
@ -69,10 +69,10 @@ Messages are identificated by unique message ids (MsgId).
It is the first column in bundle: <msgid>:<message>
Show selected message:
ii-tool [options] get <MsgId>
idecctl [options] get <MsgId>
Search message:
ii-tool [options] search <string> [echo]
idecctl [options] search <string> [echo]
.B options:
-from <user> -- from user
@ -84,37 +84,37 @@ Search message:
.fi
.TP
.B ADD USER (POINT)
ii-tool [-u pointfile] useradd <name> <e-mail> <password>
idecctl [-u pointfile] useradd <name> <e-mail> <password>
.nf
By default, pointfile is points.txt
.fi
.TP
.B BLACKLIST MSG
ii-tool [-u pointfile] useradd <name> <e-mail> <password>
idecctl [-u pointfile] useradd <name> <e-mail> <password>
.nf
Blacklist is just new record with same id but spectial status.
.fi
.SH EXAMPLES
.TP Get database from remote node and store to ./db
ii-tool fetch http://hugeping.tk
idecctl fetch http://hugeping.tk
.TP
Fetch messages
echo "std.club:this comment will be omitted" | ii-tool fetch http://127.0.0.1:8080 -
echo "std.club:this comment will be omitted" | idecctl fetch http://127.0.0.1:8080 -
.TP
get last message
ii-tool select std.club -1:1
idecctl select std.club -1:1
.TP
get first 10 messages
ii-tool select std.club 0:10
idecctl select std.club 0:10
.TP
To show last 5 messages adressed to selected user (sort ids by date with sort command)
ii-tool [options] -to <user> select "" | ii-tool sort | tail -n5 | ii-tool -v sort
idecctl [options] -to <user> select "" | idecctl sort | tail -n5 | idecctl -v sort
.TP
Show and print last message to Peter
ii-tool -v -to Peter "" -1:1
idecctl -v -to Peter "" -1:1
.SH SEE ALSO
iigo(1), ii-node(1), ii-gemini(1)
openidec(1), idecd(1), idecgmi(1)
.SH AUTHOR
hugeping ( gl00my (at) mail.ru )

View File

@ -1,8 +1,8 @@
.TH ii-node 1 "March 12, 2023" "version 0.0.1" "IIGO"
.TH idecd 1 "March 12, 2023" "version 0.0.1" "OpenIDEC"
.SH NAME
ii-node - is idec node
idecd - is idec node
.SH SYNOPSIS
.B ii-node
.B idecd
[options]
.SH DESCRIPTION
For run ii/idec node.
@ -21,7 +21,7 @@ Echos list file. This file needs only for descriptions and must be in list.txt f
Host string for node. (http://127.0.0.1:8080 by default)
.TP
-sys "name"
Node name. "ii-go" by default
Node name. "OpenIDEC" by default
.TP
-u <points>
Points file. "points.txt" by default.
@ -68,12 +68,11 @@ http://127.0.0.1:8080/from/User/rss - From User
.SH EXAMPLES
Fetch db and start node:
.nf
ii-tool fetch http://hugeping.tk # get database from remote node
idecctl fetch http://hugeping.tk # get database from remote node
ftp http://hugeping.tk/list.txt # for echo descriptions
ii-node -sys "newnode" # run node with name "newnode"
idecd -sys "newnode" # run node with name "newnode"
.fi
.SH SEE ALSO
ii-tool(1), iigo(1), ii-gemini(1)
idecctl(1), openidec(1), idecgmi(1)
.SH AUTHOR
hugeping ( gl00my (at) mail.ru )

View File

@ -1,8 +1,8 @@
.TH ii-tool 1 "March 12, 2023" "version 0.0.1" "IIGO"
.TH idecgmi 1 "March 12, 2023" "version 0.0.1" "OpenIDEC"
.SH NAME
ii-gemini - generate gemini data
idecgmi - generate gemini data
.SH SYNOPSIS
.B ii-gemini
.B idecgmi
[options] command [arguments]
.SH DESCRIPTION
Generate gemini data from idec db.
@ -14,6 +14,6 @@ generate gemini data
-db=<path>
database path
.SH SEE ALSO
ii-tool(1), ii-node(1), iigo(1)
idecctl(1), idecd(1), openidec(1)
.SH AUTHOR
hugeping ( gl00my (at) mail.ru )

View File

@ -1,21 +1,21 @@
.TH iigo 1 "March 12, 2023" "version 0.0.1" "IIGO"
.TH openidec 1 "March 12, 2023" "version 0.0.1" "OpenIDEC"
.SH NAME
iigo \- is idec node and tools
openidec \- is idec node and tools
.SH SYNOPSIS
.B ii-tool, ii-node, ii-gemini
.B idecctl, idecd, idecgmi
.SH DESCRIPTION
Easy setup and make your own ii/idec node.
.PP
.B ii-tool
.B idecctl
\- can be used to fetch messages from another node and maintaince database.
.PP
.B ii-node
.B idecd
\- runing idec node with web interface
.PP
.B ii-gemini
.B idecgmi
\- generate gemini data
.SH SEE ALSO
ii-tool(1), ii-node(1), ii-gemini(1)
idecctl(1), idecd(1), idecgmi(1)
.SH HISTORY
needed!!!
https://github.com/idec-net/new-docs/blob/master/main.md

View File

@ -1,5 +1,6 @@
<div id="footer">
Powered by <a href="https://github.com/hugeping/ii-go">ii-go</a> / 2021-2022
Powered by <a href="https://git.openbsd.org.ru/vasyahacker/openidec">OpenIDEC</a>
Original by <a href="https://github.com/hugeping/ii-go">ii-go</a> / 2021-2023
</div>
</div>
</body>