зеркало из https://github.com/nextcloud/news.git
handle SimplePie issues when adding feed
This commit is contained in:
Родитель
8ee6670cad
Коммит
4be12df25c
|
@ -10,6 +10,21 @@
|
|||
*
|
||||
*/
|
||||
|
||||
register_shutdown_function("shutdown");
|
||||
|
||||
/* handle the case of fatal error */
|
||||
function shutdown() {
|
||||
$l = OC_L10N::get('news');
|
||||
$error = error_get_last();
|
||||
if($error['type'] & (E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR)) { //all fatal errors
|
||||
if (strpos($error['message'], 'get_uri')) {
|
||||
//handle a fatal error caused by a SimplePie bug (https://github.com/simplepie/simplepie/issues/214)
|
||||
OCP\Util::writeLog('news','ajax/createfeed.php: Fatal error:' . $error['message'] , OCP\Util::ERROR);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we are a user
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::checkAppEnabled('news');
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
<id>news</id>
|
||||
<name>News</name>
|
||||
<description>An RSS/Atom feed reader</description>
|
||||
<version>6.2</version>
|
||||
<licence>AGPL</licence>
|
||||
<shipped>true</shipped>
|
||||
<author>Alessandro Cosentino</author>
|
||||
<require>4</require>
|
||||
</info>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
6.2
|
61
js/news.js
61
js/news.js
|
@ -106,6 +106,7 @@ News={
|
|||
Feed: {
|
||||
id:'',
|
||||
submit:function(button){
|
||||
|
||||
var feedurl = $("#feed_add_url").val().trim();
|
||||
|
||||
if(feedurl.length == 0) {
|
||||
|
@ -115,11 +116,15 @@ News={
|
|||
|
||||
$(button).attr("disabled", true);
|
||||
$(button).prop('value', t('news', 'Adding...'));
|
||||
|
||||
|
||||
var folderid = $('#inputfolderid:input[name="folderid"]').val();
|
||||
|
||||
$.post(OC.filePath('news', 'ajax', 'createfeed.php'), { feedurl: feedurl, folderid: folderid },
|
||||
function(jsondata){
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: OC.filePath('news', 'ajax', 'createfeed.php'),
|
||||
data: { 'feedurl': feedurl, 'folderid': folderid },
|
||||
dataType: "json",
|
||||
success: function(jsondata){
|
||||
if(jsondata.status == 'success'){
|
||||
$('div[data-id="' + folderid + '"] > ul').append(jsondata.data.listfeed);
|
||||
setupFeedList();
|
||||
|
@ -138,10 +143,50 @@ News={
|
|||
} else {
|
||||
OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
|
||||
}
|
||||
$("#feed_add_url").val('');
|
||||
$(button).attr("disabled", false);
|
||||
$(button).prop('value', t('news', 'Add feed'));
|
||||
$("#feed_add_url").val('');
|
||||
$(button).attr("disabled", false);
|
||||
$(button).prop('value', t('news', 'Add feed'));
|
||||
},
|
||||
error: function(xhr) {
|
||||
OC.dialogs.alert(t('news', 'Error while parsing the feed'), t('news', 'Fatal Error'));
|
||||
$("#feed_add_url").val('');
|
||||
$(button).attr("disabled", false);
|
||||
$(button).prop('value', t('news', 'Add feed'));
|
||||
},
|
||||
statusCode: {
|
||||
500: function() {
|
||||
OC.dialogs.alert(t('news', 'Error while parsing the feed'), t('news', 'Fatal Error'));
|
||||
$("#feed_add_url").val('');
|
||||
$(button).attr("disabled", false);
|
||||
$(button).prop('value', t('news', 'Add feed'));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// $.post(OC.filePath('news', 'ajax', 'createfeed.php'), { feedurl: feedurl, folderid: folderid },
|
||||
// function(jsondata){
|
||||
// if(jsondata.status == 'success'){
|
||||
// $('div[data-id="' + folderid + '"] > ul').append(jsondata.data.listfeed);
|
||||
// setupFeedList();
|
||||
// OC.dialogs.confirm(t('news', 'Do you want to add another feed?'), t('news', 'Feed added!'), function(answer) {
|
||||
// if(!answer) {
|
||||
// $('#addfeed_dialog').dialog('destroy').remove();
|
||||
// var rightcontent = $('div.rightcontent');
|
||||
// rightcontent.empty();
|
||||
// rightcontent.attr('data-id', jsondata.data.feedid);
|
||||
// rightcontent.html(jsondata.data.part_items);
|
||||
// rightcontent.find('ul.accordion').before(jsondata.data.part_newfeed);
|
||||
// setupRightContent();
|
||||
// transformCollapsableTrigger();
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// OC.dialogs.alert(jsondata.data.message, t('news', 'Error'));
|
||||
// }
|
||||
// $("#feed_add_url").val('');
|
||||
// $(button).attr("disabled", false);
|
||||
// $(button).prop('value', t('news', 'Add feed'));
|
||||
// });
|
||||
|
||||
},
|
||||
'delete':function(feedid) {
|
||||
|
@ -325,9 +370,9 @@ $(document).ready(function(){
|
|||
News.Feed.updateAll();
|
||||
var updateInterval = 200000; //how often the feeds should update (in msec)
|
||||
setInterval('News.Feed.updateAll()', updateInterval);
|
||||
|
||||
});
|
||||
|
||||
$(document).click(function(event) {
|
||||
$('#feedfoldermenu').hide();
|
||||
});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче