diff --git a/contracts/evoting/types/ballots.go b/contracts/evoting/types/ballots.go index 26fd3eed8..146324dfc 100644 --- a/contracts/evoting/types/ballots.go +++ b/contracts/evoting/types/ballots.go @@ -417,7 +417,7 @@ type Select struct { MaxN uint MinN uint Choices []string - Hint string + Hint string } // GetID implements Question @@ -483,7 +483,7 @@ type Rank struct { MaxN uint MinN uint Choices []string - Hint string + Hint string } func (r Rank) GetID() string { @@ -558,7 +558,7 @@ type Text struct { MaxLength uint Regex string Choices []string - Hint string + Hint string } func (t Text) GetID() string { diff --git a/go.mod b/go.mod index 7ecc4e689..1b925fc54 100644 --- a/go.mod +++ b/go.mod @@ -48,3 +48,5 @@ require ( google.golang.org/protobuf v1.31.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect ) + +replace github.com/c4dt/dela => ../dela \ No newline at end of file diff --git a/go.sum b/go.sum index 8d979c53c..cfea0af6c 100644 --- a/go.sum +++ b/go.sum @@ -45,10 +45,7 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24 github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/c4dt/dela v0.0.0-20230928144925-791c0000a6ef h1:PQV091ZRql4R8JHMwAq+WCG8sSjCykSxK5qwHe24vEM= github.com/c4dt/dela v0.0.0-20230928144925-791c0000a6ef/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY= -github.com/c4dt/dela v0.0.0-20230929152556-a801764677f2 h1:hXpyJw1UVpUOv43dJzDBXCxWOPdviXjhlNm5Fv2scfk= -github.com/c4dt/dela v0.0.0-20230929152556-a801764677f2/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY= github.com/c4dt/dela v0.0.0-20231003140702-cc92be785f8e h1:rx/djITT7JaJ0DaNb7uSroQeUKLvaUmYzanq4oh3PNw= github.com/c4dt/dela v0.0.0-20231003140702-cc92be785f8e/go.mod h1:rtOjXdQKOeIyByN4c+j698FqdKBhAk6C2u8cc/Wf3JY= github.com/c4dt/dela-apps v0.0.0-20230929051236-6d89286321f7 h1:cnB6P4hA69xh/guriaKK6gufWvimA4CBkNSAbecDPyU= diff --git a/scripts/local_vars.sh b/scripts/local_vars.sh index bb3723c0c..b1b285c00 100644 --- a/scripts/local_vars.sh +++ b/scripts/local_vars.sh @@ -9,3 +9,5 @@ export SESSION_SECRET="session secret" export REACT_APP_NOMOCK=on # shellcheck disable=SC2155 export DB_PATH="$(pwd)/nodes/llmdb" +#export PROXY_LOG=info +#export LLVL=info diff --git a/web/backend/src/controllers/dela.ts b/web/backend/src/controllers/dela.ts index 5129ccadf..3a6a91226 100644 --- a/web/backend/src/controllers/dela.ts +++ b/web/backend/src/controllers/dela.ts @@ -237,6 +237,8 @@ delaRouter.use('/*', (req, res) => { return; } + console.log(`Forwarding request to ${req.baseUrl}`); + const bodyData = req.body; // special case for voting diff --git a/web/backend/src/controllers/proxies.ts b/web/backend/src/controllers/proxies.ts index 2c751c43c..7cf5e304a 100644 --- a/web/backend/src/controllers/proxies.ts +++ b/web/backend/src/controllers/proxies.ts @@ -33,13 +33,13 @@ proxiesRouter.put('/:nodeAddr', (req, res) => { const proxy = proxiesDB.get(nodeAddr); if (proxy === undefined) { - res.status(404).send('not found'); + res.status(404).send(`proxy ${nodeAddr} not found`); return; } try { const bodydata = req.body; if (bodydata.Proxy === undefined) { - res.status(400).send('bad request, proxy is undefined'); + res.status(400).send(`bad request, proxy ${nodeAddr} is undefined`); return; } @@ -70,7 +70,7 @@ proxiesRouter.delete('/:nodeAddr', (req, res) => { const proxy = proxiesDB.get(nodeAddr); if (proxy === undefined) { - res.status(404).send('not found'); + res.status(404).send(`proxy ${nodeAddr} not found`); return; } @@ -87,6 +87,7 @@ proxiesRouter.get('', (req, res) => { const output = new Map(); proxiesDB.getRange({}).forEach((entry) => { output.set(entry.key, entry.value); + console.log(`Outputting ${entry.key} / ${entry.value}`); }); res.status(200).json({ Proxies: Object.fromEntries(output) }); @@ -98,10 +99,12 @@ proxiesRouter.get('/:nodeAddr', (req, res) => { const proxy = proxiesDB.get(decodeURIComponent(nodeAddr)); if (proxy === undefined) { - res.status(404).send('not found'); + console.log('undefined'); + res.status(404).send(`proxy ${nodeAddr} not found`); return; } + console.log('Status 200'); res.status(200).json({ NodeAddr: nodeAddr, Proxy: proxy, diff --git a/web/frontend/src/components/utils/proxy.tsx b/web/frontend/src/components/utils/proxy.tsx index 1e780e0b9..6eb81a5e7 100644 --- a/web/frontend/src/components/utils/proxy.tsx +++ b/web/frontend/src/components/utils/proxy.tsx @@ -33,6 +33,7 @@ const ProxyInput: FC = () => { // update the proxy context and sessionStore each time the proxy changes useEffect(() => { sessionStorage.setItem(proxyKey, proxy); + console.error(`DEBUG: setting proxy ${proxy}`); pctx.setProxy(proxy); setInputVal(proxy); }, [pctx, proxy]); diff --git a/web/frontend/src/pages/form/components/DKGStatusRow.tsx b/web/frontend/src/pages/form/components/DKGStatusRow.tsx index ce3680097..d2de23f7b 100644 --- a/web/frontend/src/pages/form/components/DKGStatusRow.tsx +++ b/web/frontend/src/pages/form/components/DKGStatusRow.tsx @@ -200,6 +200,7 @@ const DKGStatusRow: FC = ({ // already fetched) useEffect(() => { if (node !== null && proxy === null) { + var error; const fetchNodeProxy = async () => { try { setTimeout(() => { @@ -209,29 +210,29 @@ const DKGStatusRow: FC = ({ const response = await fetch(endpoints.getProxyAddress(node), request); if (!response.ok) { - const js = await response.json(); - throw new Error(JSON.stringify(js)); + error = Error(await response.text()); } else { let dataReceived = await response.json(); return dataReceived as NodeProxyAddress; } } catch (e) { - let errorMessage = t('errorRetrievingProxy'); - // Error triggered by timeout if (e instanceof DOMException) { - errorMessage += t('proxyUnreachable', { node: node }); + error = t('proxyUnreachable', { node: node }); } else { - errorMessage += t('error'); + error = t('error'); } + error += e; + } + let errorMessage = t('errorRetrievingProxy'); + errorMessage += error; - setInfo(errorMessage + e.message); - setStatus(NodeStatus.Unreachable); + setInfo(errorMessage); + setStatus(NodeStatus.Unreachable); - // if we could not retrieve the proxy still resolve the promise - // so that promise.then() goes to onSuccess() but display the error - return { NodeAddr: node, Proxy: '' }; - } + // if we could not retrieve the proxy still resolve the promise + // so that promise.then() goes to onSuccess() but display the error + return { NodeAddr: node, Proxy: '' }; }; setDKGLoading(true);