diff --git a/sync-module/sync_model.php b/sync-module/sync_model.php index 3ee388e..b1b143e 100644 --- a/sync-module/sync_model.php +++ b/sync-module/sync_model.php @@ -84,9 +84,14 @@ public function get_feed_list($userid) { $localfeeds = json_decode(json_encode($this->feed->get_user_feeds_with_meta($userid))); // 2. Load remote settings $remote = $this->remote_load($userid); - if (is_array($remote) && isset($remote['success']) && $remote['success']==false) return false; + if (is_array($remote) && isset($remote['success']) && $remote['success']==false) { + return array("success"=>false, "message"=>"Could not load remote configuration"); + } // 3. Load remote feeds $remotefeeds = json_decode(file_get_contents($remote->host."/feed/listwithmeta.json?apikey=".$remote->apikey_read)); + if (!$remotefeeds) { + return array("success"=>false, "message"=>"No response from remote server"); + } $feeds = array(); diff --git a/sync-module/sync_view.php b/sync-module/sync_view.php index 77f595f..d197155 100644 --- a/sync-module/sync_view.php +++ b/sync-module/sync_view.php @@ -23,6 +23,7 @@ Host Username Password + Apikey @@ -187,6 +188,10 @@ function syncList() dataType: 'json', async: true, success(result){ + if (result.success!=undefined) { + alert(result.message) + return false; + } out=jsonfeedsTohtml(result); feeds=result; $("#all_feed_datas").html(out); @@ -212,6 +217,7 @@ function remoteLoad() $(".alert").hide(); $("#remote-host").val(result.host); $("#remote-username").val(result.username); + $("#remote-apikey").val(result.apikey_write); if (subaction=="feeds") { $(".feed-view").show(); syncList();