Skip to content

Commit 53debad

Browse files
committed
One more route restoration.
1 parent e7eaae7 commit 53debad

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@
159159
],
160160

161161
'info' => [
162-
'version' => '2.3.3',
162+
'version' => '2.3.4',
163163
'homepage' => 'https://github.com/scottboms/kirby-applemusic',
164164
'license' => 'MIT',
165165
'authors' => [[ 'name' => 'Scott Boms' ]],

lib/routes.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
}
4242
],
4343

44+
4445
/**
4546
* ---------------------------------------------------------------------------
4647
* has dev token?
@@ -53,6 +54,28 @@
5354
],
5455

5556

57+
/**
58+
* ---------------------------------------------------------------------------
59+
* has mut token?
60+
*/
61+
[
62+
'pattern' => 'applemusic/token-status',
63+
'method' => 'GET',
64+
'action' => function () {
65+
if (!$user = kirby()->user()) {
66+
return Response::json(['ok' => false, 'reason' => 'unauthorized'], 401);
67+
}
68+
$token = Auth::readToken($user->id());
69+
return Response::json([
70+
'ok' => (bool) $token,
71+
'hasToken' => (bool) $token,
72+
'cacheKey' => MusicKit::cacheKey('token:' . $user->id()),
73+
'path' => Auth::tokenPath($user->id())
74+
], 200);
75+
}
76+
],
77+
78+
5679
/**
5780
* ---------------------------------------------------------------------------
5881
* returns a dev token with cors + cache via Auth::devToken

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "scottboms/applemusic",
33
"description": "Apple Music Embed",
44
"author": "Scott Boms <[email protected]>",
5-
"version": "2.3.3",
5+
"version": "2.3.4",
66
"type": "kirby-plugin",
77
"license": "MIT",
88
"scripts": {

0 commit comments

Comments
 (0)