This commit is contained in:
Simon Ding
2025-04-29 15:55:11 +08:00
parent 3eb1f37387
commit 3a73d0c33e
4 changed files with 19 additions and 8 deletions

View File

@@ -390,11 +390,13 @@ type WebdavSetting struct {
}
func (c *client) AddStorage(st *StorageInfo) error {
if !strings.HasSuffix(st.TvPath, "/") {
st.TvPath += "/"
}
if !strings.HasSuffix(st.MoviePath, "/") {
st.MoviePath += "/"
if st.Implementation != storage.ImplementationLocal.String() { //add seperator if not local storage
if !strings.HasSuffix(st.TvPath, "/") {
st.TvPath += "/"
}
if !strings.HasSuffix(st.MoviePath, "/") {
st.MoviePath += "/"
}
}
if st.Settings == nil {
st.Settings = map[string]string{}

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"polaris/db"
"strings"
"polaris/log"
"polaris/pkg/alist"
@@ -52,10 +53,17 @@ func (s *Server) AddStorage(c *gin.Context) (interface{}, error) {
if err != nil {
return nil, err
}
if !strings.HasSuffix(in.TvPath, string(os.PathSeparator)) {
in.TvPath = in.TvPath + string(os.PathSeparator)
}
_, err = os.Stat(in.MoviePath)
if err != nil {
return nil, err
}
if !strings.HasSuffix(in.MoviePath, string(os.PathSeparator)) {
in.MoviePath = in.MoviePath + string(os.PathSeparator)
}
}
log.Infof("received add storage input: %v", in)
err := s.db.AddStorage(&in)

View File

@@ -20,7 +20,7 @@ class APIs {
//static final singleSettingUrl = "$_baseUrl/api/v1/setting/";
static final watchlistTvUrl = "$_baseUrl/api/v1/media/tv/watchlist";
static final watchlistMovieUrl = "$_baseUrl/api/v1/media/movie/watchlist";
static final availableTorrentsUrl = "$_baseUrl/api/v1/media/torrents/";
static final availableTorrentsUrl = "$_baseUrl/api/v1/media/torrents";
static final downloadTorrentUrl = "$_baseUrl/api/v1/media/torrents/download";
static final seriesDetailUrl = "$_baseUrl/api/v1/media/record/";
static final suggestedTvName = "$_baseUrl/api/v1/media/suggest/tv/";
@@ -83,6 +83,7 @@ class APIs {
static Dio getDio() {
var dio = Dio();
dio.options.followRedirects = true;
dio.interceptors.add(InterceptorsWrapper(
onError: (error, handler) {
if (error.response?.statusCode != null &&

View File

@@ -281,8 +281,8 @@ class TorrentResource {
String? link;
String? source;
int? indexerId;
double? downloadFactor;
double? uploadFactor;
num? downloadFactor;
num? uploadFactor;
bool? isPrivate;
factory TorrentResource.fromJson(Map<String, dynamic> json) {