mirror of
https://github.com/simon-ding/polaris.git
synced 2026-03-01 23:20:47 +08:00
fix
This commit is contained in:
12
db/db.go
12
db/db.go
@@ -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{}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user