Skip to content

Commit 4eba341

Browse files
committed
Removed duplicate json encode
1 parent 3be06bc commit 4eba341

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

appinfo/routes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
array('name' => 'ownnote_api#index', 'url' => '/api/v0.2/ownnote', 'verb' => 'GET'),
2828
array('name' => 'ownnote_api#ajaxindex', 'url' => '/api/v0.2/ownnote/ajaxindex', 'verb' => 'GET'),
2929
array('name' => 'ownnote_api#remoteindex', 'url' => '/api/v0.2/ownnote/remoteindex', 'verb' => 'GET'),
30+
array('name' => 'ownnote_api#mobileindex', 'url' => '/api/v0.2/ownnote/mobileindex', 'verb' => 'GET'),
3031
array('name' => 'ownnote_api#announcement', 'url' => '/api/v0.2/ownnote/announcement', 'verb' => 'GET'),
3132
array('name' => 'ownnote_api#ajaxannouncement', 'url' => '/api/v0.2/ownnote/ajaxannouncement', 'verb' => 'GET'),
3233
array('name' => 'ownnote_api#version', 'url' => '/api/v0.2/ownnote/version', 'verb' => 'GET'),

controller/ownnoteapicontroller.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($appName, IRequest $request){
4242
*/
4343
public function ajaxindex() {
4444
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes');
45-
return json_encode($this->backend->getListing($FOLDER, false));
45+
return $this->backend->getListing($FOLDER, false);
4646
}
4747

4848
/**
@@ -149,7 +149,17 @@ public function ajaxsetval($field, $value) {
149149
*/
150150
public function index() {
151151
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes');
152-
return json_encode($this->backend->getListing($FOLDER, false));
152+
return $this->backend->getListing($FOLDER, false);
153+
}
154+
155+
/**
156+
* @NoAdminRequired
157+
* @CORS
158+
* @NoCSRFRequired
159+
*/
160+
public function mobileindex() {
161+
$FOLDER = \OCP\Config::getAppValue('ownnote', 'folder', 'Notes');
162+
return $this->backend->getListing($FOLDER, true);
153163
}
154164

155165
/**

js/script.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@
215215
return false;
216216
}
217217

218-
var filelist = "";
219218
var listing;
220219
var listingtype = "All";
221220
var sortby = "name";
@@ -238,8 +237,7 @@
238237
function loadListing() {
239238
var url = ocUrl("api/v0.2/ownnote/ajaxindex");
240239
$.get(url, function(data) {
241-
filelist = data;
242-
listing = jQuery.parseJSON(filelist);
240+
listing = data;
243241
buildNav(listingtype);
244242
buildListing();
245243
if (switchgroup != "") {

0 commit comments

Comments
 (0)