mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-07 10:37:39 +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 {
|
func (c *client) AddStorage(st *StorageInfo) error {
|
||||||
if !strings.HasSuffix(st.TvPath, "/") {
|
if st.Implementation != storage.ImplementationLocal.String() { //add seperator if not local storage
|
||||||
st.TvPath += "/"
|
if !strings.HasSuffix(st.TvPath, "/") {
|
||||||
}
|
st.TvPath += "/"
|
||||||
if !strings.HasSuffix(st.MoviePath, "/") {
|
}
|
||||||
st.MoviePath += "/"
|
if !strings.HasSuffix(st.MoviePath, "/") {
|
||||||
|
st.MoviePath += "/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if st.Settings == nil {
|
if st.Settings == nil {
|
||||||
st.Settings = map[string]string{}
|
st.Settings = map[string]string{}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"polaris/db"
|
"polaris/db"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"polaris/log"
|
"polaris/log"
|
||||||
"polaris/pkg/alist"
|
"polaris/pkg/alist"
|
||||||
@@ -52,10 +53,17 @@ func (s *Server) AddStorage(c *gin.Context) (interface{}, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
if !strings.HasSuffix(in.TvPath, string(os.PathSeparator)) {
|
||||||
|
in.TvPath = in.TvPath + string(os.PathSeparator)
|
||||||
|
}
|
||||||
_, err = os.Stat(in.MoviePath)
|
_, err = os.Stat(in.MoviePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
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)
|
log.Infof("received add storage input: %v", in)
|
||||||
err := s.db.AddStorage(&in)
|
err := s.db.AddStorage(&in)
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ class APIs {
|
|||||||
//static final singleSettingUrl = "$_baseUrl/api/v1/setting/";
|
//static final singleSettingUrl = "$_baseUrl/api/v1/setting/";
|
||||||
static final watchlistTvUrl = "$_baseUrl/api/v1/media/tv/watchlist";
|
static final watchlistTvUrl = "$_baseUrl/api/v1/media/tv/watchlist";
|
||||||
static final watchlistMovieUrl = "$_baseUrl/api/v1/media/movie/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 downloadTorrentUrl = "$_baseUrl/api/v1/media/torrents/download";
|
||||||
static final seriesDetailUrl = "$_baseUrl/api/v1/media/record/";
|
static final seriesDetailUrl = "$_baseUrl/api/v1/media/record/";
|
||||||
static final suggestedTvName = "$_baseUrl/api/v1/media/suggest/tv/";
|
static final suggestedTvName = "$_baseUrl/api/v1/media/suggest/tv/";
|
||||||
@@ -83,6 +83,7 @@ class APIs {
|
|||||||
|
|
||||||
static Dio getDio() {
|
static Dio getDio() {
|
||||||
var dio = Dio();
|
var dio = Dio();
|
||||||
|
dio.options.followRedirects = true;
|
||||||
dio.interceptors.add(InterceptorsWrapper(
|
dio.interceptors.add(InterceptorsWrapper(
|
||||||
onError: (error, handler) {
|
onError: (error, handler) {
|
||||||
if (error.response?.statusCode != null &&
|
if (error.response?.statusCode != null &&
|
||||||
|
|||||||
@@ -281,8 +281,8 @@ class TorrentResource {
|
|||||||
String? link;
|
String? link;
|
||||||
String? source;
|
String? source;
|
||||||
int? indexerId;
|
int? indexerId;
|
||||||
double? downloadFactor;
|
num? downloadFactor;
|
||||||
double? uploadFactor;
|
num? uploadFactor;
|
||||||
bool? isPrivate;
|
bool? isPrivate;
|
||||||
|
|
||||||
factory TorrentResource.fromJson(Map<String, dynamic> json) {
|
factory TorrentResource.fromJson(Map<String, dynamic> json) {
|
||||||
|
|||||||
Reference in New Issue
Block a user