mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(releases): show details in list view (#1337)
* feat(releases): show details in list view * fix(releases): activitytable columns type * fix(releases): incognito mode * feat(releases): move details button * do we wanna truncate? * fix(web): release column width at full size --------- Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
This commit is contained in:
parent
7eaf499d66
commit
9992675971
8 changed files with 155 additions and 91 deletions
|
@ -211,7 +211,7 @@ func (repo *ReleaseRepo) findReleases(ctx context.Context, tx *Tx, params domain
|
|||
}
|
||||
|
||||
queryBuilder := repo.db.squirrel.
|
||||
Select("r.id", "r.filter_status", "r.rejections", "r.indexer", "r.filter", "r.protocol", "r.info_url", "r.download_url", "r.title", "r.torrent_name", "r.size", "r.timestamp",
|
||||
Select("r.id", "r.filter_status", "r.rejections", "r.indexer", "r.filter", "r.protocol", "r.info_url", "r.download_url", "r.title", "r.torrent_name", "r.size", "r.category", "r.season", "r.episode", "r.year", "r.resolution", "r.source", "r.codec", "r.container", "r.release_group", "r.timestamp",
|
||||
"ras.id", "ras.status", "ras.action", "ras.action_id", "ras.type", "ras.client", "ras.filter", "ras.filter_id", "ras.release_id", "ras.rejections", "ras.timestamp").
|
||||
Column(sq.Alias(countQuery, "page_total")).
|
||||
From("release r").
|
||||
|
@ -245,17 +245,22 @@ func (repo *ReleaseRepo) findReleases(ctx context.Context, tx *Tx, params domain
|
|||
var rls domain.Release
|
||||
var ras domain.ReleaseActionStatus
|
||||
|
||||
var rlsindexer, rlsfilter, infoUrl, downloadUrl sql.NullString
|
||||
var rlsindexer, rlsfilter, infoUrl, downloadUrl, codec sql.NullString
|
||||
|
||||
var rasId, rasFilterId, rasReleaseId, rasActionId sql.NullInt64
|
||||
var rasStatus, rasAction, rasType, rasClient, rasFilter sql.NullString
|
||||
var rasRejections []sql.NullString
|
||||
var rasTimestamp sql.NullTime
|
||||
|
||||
if err := rows.Scan(&rls.ID, &rls.FilterStatus, pq.Array(&rls.Rejections), &rlsindexer, &rlsfilter, &rls.Protocol, &infoUrl, &downloadUrl, &rls.Title, &rls.TorrentName, &rls.Size, &rls.Timestamp, &rasId, &rasStatus, &rasAction, &rasActionId, &rasType, &rasClient, &rasFilter, &rasFilterId, &rasReleaseId, pq.Array(&rasRejections), &rasTimestamp, &countItems); err != nil {
|
||||
if err := rows.Scan(&rls.ID, &rls.FilterStatus, pq.Array(&rls.Rejections), &rlsindexer, &rlsfilter, &rls.Protocol, &infoUrl, &downloadUrl, &rls.Title, &rls.TorrentName, &rls.Size, &rls.Category, &rls.Season, &rls.Episode, &rls.Year, &rls.Resolution, &rls.Source, &codec, &rls.Container, &rls.Group, &rls.Timestamp, &rasId, &rasStatus, &rasAction, &rasActionId, &rasType, &rasClient, &rasFilter, &rasFilterId, &rasReleaseId, pq.Array(&rasRejections), &rasTimestamp, &countItems); err != nil {
|
||||
return res, 0, 0, errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
//for _, codec := range codecs {
|
||||
// rls.Codec = append(rls.Codec, codec.String)
|
||||
//
|
||||
//}
|
||||
|
||||
ras.ID = rasId.Int64
|
||||
ras.Status = domain.ReleasePushStatus(rasStatus.String)
|
||||
ras.Action = rasAction.String
|
||||
|
@ -291,6 +296,7 @@ func (repo *ReleaseRepo) findReleases(ctx context.Context, tx *Tx, params domain
|
|||
rls.ActionStatus = make([]domain.ReleaseActionStatus, 0)
|
||||
rls.InfoURL = infoUrl.String
|
||||
rls.DownloadURL = downloadUrl.String
|
||||
rls.Codec = strings.Split(codec.String, ",")
|
||||
|
||||
// only add ActionStatus if it's not empty
|
||||
if ras.ID > 0 {
|
||||
|
|
|
@ -59,7 +59,7 @@ type Release struct {
|
|||
TorrentTmpFile string `json:"-"`
|
||||
TorrentDataRawBytes []byte `json:"-"`
|
||||
TorrentHash string `json:"-"`
|
||||
TorrentName string `json:"torrent_name"` // full release name
|
||||
TorrentName string `json:"name"` // full release name
|
||||
Size uint64 `json:"size"`
|
||||
Title string `json:"title"` // Parsed title
|
||||
Description string `json:"-"`
|
||||
|
@ -538,32 +538,6 @@ func (r *Release) HasMagnetUri() bool {
|
|||
return r.MagnetURI != ""
|
||||
}
|
||||
|
||||
type magnetRoundTripper struct{}
|
||||
|
||||
func (rt *magnetRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||
if r.URL.Scheme == "magnet" {
|
||||
responseBody := r.URL.String()
|
||||
respReader := io.NopCloser(strings.NewReader(responseBody))
|
||||
|
||||
resp := &http.Response{
|
||||
Status: http.StatusText(http.StatusOK),
|
||||
StatusCode: http.StatusOK,
|
||||
Body: respReader,
|
||||
ContentLength: int64(len(responseBody)),
|
||||
Header: map[string][]string{
|
||||
"Content-Type": {"text/plain"},
|
||||
"Location": {responseBody},
|
||||
},
|
||||
Proto: "HTTP/2.0",
|
||||
ProtoMajor: 2,
|
||||
}
|
||||
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
return http.DefaultTransport.RoundTrip(r)
|
||||
}
|
||||
|
||||
func (r *Release) ResolveMagnetUri(ctx context.Context) error {
|
||||
if r.MagnetURI == "" {
|
||||
return nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue