diff options
author | Arthur <arthur@hoa.ro> | 2016-12-20 11:30:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-20 11:30:05 +0100 |
commit | 80677a23e2e10d78bc527e9754286787b453ce61 (patch) | |
tree | 18feefc47f389171f3886b191fb14f2ace6d0175 /application/Updater.php | |
parent | e350aa750f9e9e742bb60a1e04ebd9e21f763c78 (diff) | |
parent | 18e6796726d73d7dc90ecdd16c181493941f5487 (diff) | |
download | Shaarli-80677a23e2e10d78bc527e9754286787b453ce61.tar.gz Shaarli-80677a23e2e10d78bc527e9754286787b453ce61.tar.zst Shaarli-80677a23e2e10d78bc527e9754286787b453ce61.zip |
Merge pull request #666 from ArthurHoaro/slim-api
REST API structure using Slim framework
Diffstat (limited to 'application/Updater.php')
-rw-r--r-- | application/Updater.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/application/Updater.php b/application/Updater.php index f0d02814..38de3350 100644 --- a/application/Updater.php +++ b/application/Updater.php | |||
@@ -256,6 +256,29 @@ class Updater | |||
256 | 256 | ||
257 | return true; | 257 | return true; |
258 | } | 258 | } |
259 | |||
260 | /** | ||
261 | * Initialize API settings: | ||
262 | * - api.enabled: true | ||
263 | * - api.secret: generated secret | ||
264 | */ | ||
265 | public function updateMethodApiSettings() | ||
266 | { | ||
267 | if ($this->conf->exists('api.secret')) { | ||
268 | return true; | ||
269 | } | ||
270 | |||
271 | $this->conf->set('api.enabled', true); | ||
272 | $this->conf->set( | ||
273 | 'api.secret', | ||
274 | generate_api_secret( | ||
275 | $this->conf->get('credentials.login'), | ||
276 | $this->conf->get('credentials.salt') | ||
277 | ) | ||
278 | ); | ||
279 | $this->conf->write($this->isLoggedIn); | ||
280 | return true; | ||
281 | } | ||
259 | } | 282 | } |
260 | 283 | ||
261 | /** | 284 | /** |