mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Replaced get and post with ajax to prevent XSRF.
Replaced some usages of Console.Writeline with proper logging.
This commit is contained in:
parent
2cbc78c780
commit
50e91c0043
6 changed files with 53 additions and 27 deletions
|
@ -64,9 +64,14 @@ $(window).load(function () {
|
|||
refreshNotifications();
|
||||
}
|
||||
|
||||
|
||||
function refreshNotifications() {
|
||||
$.get('/notification/Comet', { message: currentMessage }, notificationCallback);
|
||||
$.ajax({
|
||||
url: '/notification/Comet',
|
||||
data: { message: currentMessage },
|
||||
success: function (data) {
|
||||
notificationCallback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function notificationCallback(data) {
|
||||
|
@ -83,10 +88,6 @@ $(window).load(function () {
|
|||
}
|
||||
|
||||
//SetupNotifications();
|
||||
//DisplayMsg("Scanning Series Folder.");
|
||||
|
||||
|
||||
|
||||
function displayMsg(sMsg) {
|
||||
//set the message text
|
||||
$("#msgText").showHtml(sMsg, 150);
|
||||
|
|
|
@ -20,9 +20,7 @@ $(".masterQualitySelector").live('change', function () {
|
|||
});
|
||||
|
||||
$(".addExistingButton").live('click', function () {
|
||||
|
||||
var root = $(this).parents(".existingSeries");
|
||||
|
||||
var title = $(this).siblings(".seriesLookup").val();
|
||||
var seriesId = $(this).siblings(".seriesId").val();
|
||||
var qualityId = $(this).siblings(".qualitySelector").val();
|
||||
|
@ -44,16 +42,27 @@ $(".addExistingButton").live('click', function () {
|
|||
});
|
||||
|
||||
function reloadExistingSeries() {
|
||||
$.get(existingSeriesUrl, function (data) {
|
||||
$.ajax({
|
||||
url: existingSeriesUrl,
|
||||
success: function( data ) {
|
||||
$('#existingSeries').html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//RootDir
|
||||
//Delete RootDir
|
||||
$('#rootDirs .actionButton img').live('click', function (image) {
|
||||
var path = $(image.target).attr('id');
|
||||
$.post(deleteRootDirUrl, { Path: path }, function () {
|
||||
refreshRoot();
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: deleteRootDirUrl,
|
||||
data: { Path: path },
|
||||
success: function () {
|
||||
refreshRoot();
|
||||
$("#rootDirInput").val('');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -61,20 +70,29 @@ $('#saveDir').live('click', saveRootDir);
|
|||
|
||||
function saveRootDir() {
|
||||
var path = $("#rootDirInput").val();
|
||||
|
||||
if (path) {
|
||||
$.post(saveRootDirUrl, { Path: path }, function () {
|
||||
refreshRoot();
|
||||
$("#rootDirInput").val('');
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: saveRootDirUrl,
|
||||
data: { Path: path },
|
||||
success: function () {
|
||||
refreshRoot();
|
||||
$("#rootDirInput").val('');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function refreshRoot() {
|
||||
$.get(rootListUrl, function (data) {
|
||||
$('#rootDirs').html(data);
|
||||
$.ajax({
|
||||
url: rootListUrl,
|
||||
success: function (data) {
|
||||
$('#rootDirs').html(data);
|
||||
reloadAddNew();
|
||||
reloadExistingSeries();
|
||||
}
|
||||
});
|
||||
reloadAddNew();
|
||||
reloadExistingSeries();
|
||||
}
|
||||
|
||||
|
||||
|
@ -94,14 +112,16 @@ $('#saveNewSeries').live('click', function () {
|
|||
},
|
||||
success: function () {
|
||||
$("#newSeriesLookup").val("");
|
||||
//$('#newSeriesPath').val("");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function reloadAddNew() {
|
||||
$.get(addNewUrl, function (data) {
|
||||
$('#addNewSeries').html(data);
|
||||
$.ajax({
|
||||
url: addNewUrl,
|
||||
success: function (data) {
|
||||
$('#addNewSeries').html(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -121,7 +141,7 @@ $('#quickAddNew').live('click', function () {
|
|||
},
|
||||
success: function () {
|
||||
$("#newSeriesLookup").val("");
|
||||
//$('#newSeriesPath').val("");
|
||||
$('#newSeriesPath').val("");
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue