Change the type of torrent's id from int to string
This commit is contained in:
parent
dcca50671c
commit
0be12b2fa1
@ -56,7 +56,7 @@ func setupRoutes(env *web.Env) {
|
||||
// Torrents routes
|
||||
env.Handle("/torrents", torrents.DownloadHandler).WithRole(users.UserRole).Methods("POST")
|
||||
env.Handle("/torrents", torrents.ListHandler).WithRole(users.UserRole).Methods("GET")
|
||||
env.Handle("/torrents/{id:[0-9]+}", torrents.RemoveHandler).WithRole(users.UserRole).Methods("DELETE")
|
||||
env.Handle("/torrents/{id}", torrents.RemoveHandler).WithRole(users.UserRole).Methods("DELETE")
|
||||
env.Handle("/torrents/search/{type}/{search}", torrents.SearchHandler).WithRole(users.UserRole).Methods("GET")
|
||||
|
||||
// Route to refresh all movies and shows
|
||||
|
@ -5,14 +5,13 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/odwrtw/polochon/lib"
|
||||
"github.com/sirupsen/logrus"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/auth"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/users"
|
||||
"git.quimbo.fr/odwrtw/canape/backend/web"
|
||||
"github.com/gorilla/mux"
|
||||
polochon "github.com/odwrtw/polochon/lib"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// DownloadHandler downloads a movie via polochon
|
||||
@ -79,10 +78,7 @@ func RemoveHandler(env *web.Env, w http.ResponseWriter, r *http.Request) error {
|
||||
|
||||
// Get the torrent ID from the URL
|
||||
vars := mux.Vars(r)
|
||||
torrentID, err := strconv.Atoi(vars["id"])
|
||||
if err != nil {
|
||||
return env.RenderError(w, errors.New("invalid argument"))
|
||||
}
|
||||
torrentID := vars["id"]
|
||||
|
||||
client, err := user.NewPapiClient()
|
||||
if err != nil {
|
||||
|
@ -111,7 +111,7 @@ class Torrent extends React.PureComponent {
|
||||
this.handleClick = this.handleClick.bind(this);
|
||||
}
|
||||
handleClick() {
|
||||
this.props.removeTorrent(this.props.data.getIn(["additional_infos", "id"]));
|
||||
this.props.removeTorrent(this.props.data.get("id"));
|
||||
}
|
||||
render() {
|
||||
const done = this.props.data.get("is_finished");
|
||||
|
Loading…
x
Reference in New Issue
Block a user