-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.php
executable file
·66 lines (65 loc) · 1.67 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
@include_once __DIR__ . '/lib/functions.php';
Kirby::plugin('f-mahler/kirby-vercel', [
'options' => [
'deployurl' => 'defaultValue',
'token' => 'default',
'projectid' => 'default',
'hooks' => null,
'cache' => true,
],
'fields' => [
'vercel' => [
'props' => [
'label' => function ($value = "Vercel") {
return $value;
},
'deploy' => function ($value = "Deploy") {
return $value;
},
'loading' => function ($value = "Deploying...") {
return $value;
},
'complete' => function ($value = "Complete") {
return $value;
},
'error' => function ($value = "Failed to deploy") {
return $value;
},
'button' => function ($value = true) {
return $value;
},
'help' => function ($value = false) {
return $value;
},
],
'computed' => [
'siteModified' => function () {
$cache = kirby()->cache('f-mahler.kirby-vercel');
$modified = [
'timestamp' => $cache->get('timestamp'),
'count' => $cache->get('count')
];
return $modified;
}
]
]
],
'hooks' => @include_once __DIR__ . '/lib/hooks.php',
'api' => [
'routes' => [
[
'pattern' => 'vercel',
'action' => function() {
return Lib\KirbyVercel\Functions::deploy();
}
],
[
'pattern' => 'vercel/latest',
'action' => function() {
return Lib\KirbyVercel\Functions::latest();
}
],
]
]
]);