This repository has been archived by the owner on Mar 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: mobile inbox request does not take session Signed-off-by: Sander Pick <sanderpick@gmail.com> * ipfs: permanently add bootstap peers to peer table on start Signed-off-by: Sander Pick <sanderpick@gmail.com> * service: update message handlign to latest libp2p Signed-off-by: Sander Pick <sanderpick@gmail.com> * service: properly inc attempts from failed unstore requests Signed-off-by: Sander Pick <sanderpick@gmail.com> * chore: remove nodejs dependency This is a golang project. As such, requiring users to install nodejs is not idiomatic. Signed-off-by: Sander Pick <sanderpick@gmail.com> * test: revert removal of add peer to store Signed-off-by: Sander Pick <sanderpick@gmail.com> * cmd: add publish command Signed-off-by: Sander Pick <sanderpick@gmail.com> * docs: update swagger docs Signed-off-by: Sander Pick <sanderpick@gmail.com> * chore: replace main files with named versions Signed-off-by: Sander Pick <sanderpick@gmail.com>
- Loading branch information
1 parent
8cee3ce
commit 0a9eb98
Showing
39 changed files
with
312 additions
and
143 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
setup: | ||
go mod download | ||
go get github.com/ahmetb/govvv | ||
npm install | ||
|
||
test: | ||
./test_compile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package cmd | ||
|
||
import ( | ||
"net/http" | ||
"os" | ||
) | ||
|
||
func Publish(topic string) error { | ||
res, err := executeStringCmd(http.MethodPost, "publish", params{ | ||
args: []string{topic}, | ||
payload: os.Stdin, | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
output(res) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package core | ||
|
||
import ( | ||
"io/ioutil" | ||
"net/http" | ||
|
||
"github.com/gin-gonic/gin" | ||
) | ||
|
||
// publish godoc | ||
// @Summary Publish payload to topic | ||
// @Description Publishes payload bytes to a topic on the network. | ||
// @Tags utils | ||
// @Accept application/octet-stream | ||
// @Produce text/plain | ||
// @Param X-Textile-Args header string true "topic" | ||
// @Success 204 {string} string "ok" | ||
// @Failure 500 {string} string "Internal Server Error" | ||
// @Router /publish [post] | ||
func (a *api) publish(g *gin.Context) { | ||
args, err := a.readArgs(g) | ||
if err != nil { | ||
a.abort500(g, err) | ||
return | ||
} | ||
|
||
if len(args) == 0 { | ||
g.String(http.StatusBadRequest, "missing topic") | ||
return | ||
} | ||
|
||
payload, err := ioutil.ReadAll(g.Request.Body) | ||
if err != nil { | ||
g.String(http.StatusBadRequest, err.Error()) | ||
return | ||
} | ||
|
||
err = a.node.Publish(payload, args[0]) | ||
if err != nil { | ||
a.abort500(g, err) | ||
return | ||
} | ||
|
||
g.Status(http.StatusNoContent) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.