[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet-go] branch master updated: Plugin integration (ZoneMaster)
From: |
gnunet |
Subject: |
[gnunet-go] branch master updated: Plugin integration (ZoneMaster) |
Date: |
Fri, 11 Nov 2022 11:57:23 +0100 |
This is an automated email from the git hooks/post-receive script.
bernd-fix pushed a commit to branch master
in repository gnunet-go.
The following commit(s) were added to refs/heads/master by this push:
new 1a72848 Plugin integration (ZoneMaster)
1a72848 is described below
commit 1a7284815bb2a63aac6b726e9167baed4813aa95
Author: Bernd Fix <brf@hoi-polloi.org>
AuthorDate: Fri Nov 11 11:56:38 2022 +0100
Plugin integration (ZoneMaster)
---
src/gnunet/service/gns/rr/coexist.go | 7 ++++++-
src/gnunet/service/zonemaster/gui.go | 34 +++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/src/gnunet/service/gns/rr/coexist.go
b/src/gnunet/service/gns/rr/coexist.go
index 1037b11..10c595a 100644
--- a/src/gnunet/service/gns/rr/coexist.go
+++ b/src/gnunet/service/gns/rr/coexist.go
@@ -56,8 +56,13 @@ func CanCoexist(t enums.GNSType, list []*enums.GNSSpec,
label string) (ok bool,
Flags: forced,
}
for i, e := range testList {
+ // skip unknown types
+ if rr = NilRR(e.Type); rr == nil {
+ return true, 0
+ }
+ // check replacement
testList[i] = eNew
- ok, forced = NilRR(e.Type).Coexist(testList, label)
+ ok, forced = rr.Coexist(testList, label)
if !ok {
return
}
diff --git a/src/gnunet/service/zonemaster/gui.go
b/src/gnunet/service/zonemaster/gui.go
index 0442fbf..9489130 100644
--- a/src/gnunet/service/zonemaster/gui.go
+++ b/src/gnunet/service/zonemaster/gui.go
@@ -625,15 +625,23 @@ func (zm *ZoneMaster) editRec(w http.ResponseWriter, r
*http.Request, data *NewE
if rec, err = zm.zdb.GetRecord(data.Ref); err != nil {
return
}
+ // default GUI dialog template name
+ dialog := "edit_rec"
+
+ // get possible plugin handler
+ plugin, ok := zm.hdlrs[rec.RType]
+ if ok {
+ // get custom edit dialog
+ _, dialog = plugin.TemplateNames()
+ }
// get prefix used for attributes and fields
pf, ok := dlgPrefix[rec.RType]
if !ok {
// no prefix defined; ask plugin
- inst, ok := zm.hdlrs[rec.RType]
- if !ok {
+ if plugin == nil {
return errors.New("no prefix defined for record type")
}
- pf = inst.Prefix(uint32(rec.RType)) + "_"
+ pf = plugin.Prefix(uint32(rec.RType)) + "_"
}
// save shared attributes
@@ -665,14 +673,22 @@ func (zm *ZoneMaster) editRec(w http.ResponseWriter, r
*http.Request, data *NewE
if rec.Flags&enums.GNS_FLAG_CRITICAL != 0 {
data.Params[pf+"critical"] = "on"
}
- // get record instance
- var inst rr.RR
- if inst, err = rr.ParseRR(rec.RType, rec.Data); err == nil {
- // add RR attributes to list
- inst.ToMap(data.Params, pf)
+ // set record attributes
+ if plugin != nil {
+ var params map[string]string
+ params, err = plugin.ToMap(uint32(rec.RType), rec.Data)
+ for k, v := range params {
+ data.Params[k] = v
+ }
+ } else {
+ var inst rr.RR
+ if inst, err = rr.ParseRR(rec.RType, rec.Data); err == nil {
+ // add RR attributes to list
+ inst.ToMap(data.Params, pf)
+ }
}
// show dialog
- renderPage(w, data, "edit_rec")
+ renderPage(w, data, dialog)
return
}
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnunet-go] branch master updated: Plugin integration (ZoneMaster),
gnunet <=