2019-08-05 16:47:52 +12:00
<?php
use Utopia\Locale\Locale;
$events = [
'database.documents.create',
'database.documents.patch',
'database.documents.delete',
'auth.register',
'auth.confirm',
'auth.login',
'auth.logout',
'account.update-name',
'account.update-email',
'account.update-password',
];
?>
2019-08-05 17:51:02 +12:00
< div class = "cover margin-bottom-large" >
< h1 class = "zone xl margin-bottom-large margin-top" >
<?php echo Locale :: getText ( 'console.webhooks.title' ); ?>
< / h1 >
< / div >
2019-08-05 16:47:52 +12:00
2019-08-08 06:10:53 +12:00
< div class = "zone xl"
data-service="projects.listWebhooks"
data-scope="console"
data-event="load,webhook-create,webhook-update,webhook-delete"
data-name="console-webhooks"
data-param-project-id="{{router.params.project}}"
data-success="trigger"
data-success-param-trigger-events="webhook-load">
2019-08-05 16:47:52 +12:00
< div data-ls-if = "0 == {{console-webhooks.length}} || undefined == {{console-webhooks.length}}" class = "box margin-top margin-bottom" style = "display: none;" >
2019-08-05 17:51:02 +12:00
< h3 class = "margin-bottom-small" > No Webhooks Found< / h3 >
2019-08-05 16:47:52 +12:00
< p class = "margin-bottom-no" > You haven't created any webhooks for your project yet.< / p >
< / div >
< div class = "box margin-bottom" data-ls-if = "0 != {{console-webhooks.length}}" style = "display: none;" >
< ul data-ls-loop = "console-webhooks" data-ls-as = "webhook" class = "list" >
< li class = "clear" >
< div data-ui-modal class = "modal close" data-button-text = "Update" data-button-class = "pull-end" >
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 > Update Webhook< / h1 >
2019-08-08 06:10:53 +12:00
< form
data-service="projects.updateWebhook"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Updated webhook successfully"
data-success-param-trigger-events="webhook-update,modal-close"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to update webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{console-project.$uid}}" >
< input type = "hidden" name = "webhookId" data-ls-bind = "{{webhook.$uid}}" >
< label data-ls-attrs = "for=name-{{webhook.$uid}}" > Name< / label >
< input type = "text" class = "full-width" data-ls-attrs = "id=name-{{webhook.$uid}}" name = "name" required autocomplete = "off" data-ls-bind = "{{webhook.name}}" / >
< label data-ls-attrs = "for=events-{{webhook.$uid}}" > Events< / label >
< div class = "row thin margin-bottom" >
<?php foreach ( $events as $i => $event ) : ?>
< div class = "col span-6" >
2019-08-06 16:19:16 +12:00
< input type = "checkbox" name = "events" data-ls-bind = "{{webhook.events}}" value = " <?php echo $event ; ?> " /> <?php echo $event ; ?>
2019-08-05 16:47:52 +12:00
< / div >
<?php if (( $i + 1 ) % 2 === 0 ) : ?>
< / div >
< div class = "row thin margin-bottom" >
<?php endif ; ?>
<?php endforeach ; ?>
< / div >
< label data-ls-attrs = "for=url-{{webhook.$uid}}" > POST URL< / label >
< input type = "url" class = "full-width" data-ls-attrs = "id=url-{{webhook.$uid}}" name = "url" required autocomplete = "off" placeholder = "https://example.com/callback" data-ls-bind = "{{webhook.url}}" / >
2019-08-09 18:40:52 +12:00
< div class = "margin-bottom toggle" data-ls-ui-open >
< i class = "icon-plus pull-end margin-top-tiny" > < / i >
< i class = "icon-minus pull-end margin-top-tiny" > < / i >
< h2 class = "margin-bottom" >
Advanced Options
< small class = "note text-size-small" > (optional)< / small >
< / h2 >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< label data-ls-attrs = "for=secure-{{webhook.$uid}}" > SSL / TLS< / label >
< p class = "note" > Certificate verification< / p >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< input name = "security" data-ls-attrs = "id=secure-yes-{{webhook.$uid}}" type = "radio" required data-ls-bind = "{{webhook.security}}" value = "1" / > < span > Enabled< / span >
< input name = "security" data-ls-attrs = "id=secure-no-{{webhook.$uid}}" type = "radio" required data-ls-bind = "{{webhook.security}}" value = "0" / > < span > Disabled< / span >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< br / >
< br / >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< p class = "note margin-bottom" > < span class = "tag red" > Warning< / span > Untrusted or self-signed certificates may not be secure.
< a href = "https://en.wikipedia.org/wiki/Self-signed_certificate" target = "_blank" rel = "noopener" > Learn more< i class = "icon-link-ext" > < / i > < / a >
< / p >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< h3 > HTTP Authentication < span class = "tooltip" data-tooltip = "Use to secure your endpoint from untrusted sources" > < i class = "icon-question" > < / i > < / span > < small > (optional)< / small > < / h3 >
< div class = "row thin" >
< div class = "col span-6" >
< label data-ls-attrs = "for=httpUser-{{webhook.$uid}}" > User< / label >
< input type = "text" class = "full-width" data-ls-attrs = "id=httpUser-{{webhook.$uid}}" name = "httpUser" autocomplete = "off" data-ls-bind = "{{webhook.httpUser}}" / >
< / div >
< div class = "col span-6" >
< label data-ls-attrs = "for=httpPass-{{webhook.$uid}}" > Password< / label >
< input type = "password" class = "full-width" data-ls-attrs = "id=httpPass-{{webhook.$uid}}" name = "httpPass" autocomplete = "off" data-ls-bind = "{{webhook.httpPass}}" / >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
2019-08-06 16:19:16 +12:00
< button type = "submit" > Save< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
2019-08-05 16:47:52 +12:00
< / form >
< / div >
2019-08-08 06:10:53 +12:00
< form class = "pull-end margin-end"
data-service="projects.deleteWebhook"
data-scope="console"
data-event="submit"
data-confirm="Are you sure you want to delete this webhook?"
data-success="alert,trigger"
data-success-param-alert-text="Deleted webhook successfully"
data-success-param-trigger-events="webhook-delete"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to delete webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{console-project.$uid}}" >
< input type = "hidden" name = "webhookId" data-ls-bind = "{{webhook.$uid}}" >
< button class = "danger reverse" > Delete< / button >
< / form >
< span data-ls-bind = "{{webhook.name}}" > < / span > (< span data-ls-bind = "{{webhook.events.length}}" > < / span > events)
< span data-ls-if = "0 == {{webhook.security}}" style = "display: none;" >
< span class = "note text-danger" > (SSL/TLS Disabled)< / span >
< / span >
2019-08-09 18:05:45 +12:00
< div class = "margin-top-tiny" >
< a data-ls-attrs = "href={{webhook.url}}" data-ls-bind = "{{webhook.url}}" target = "_blank" class = "text-one-liner" > < / a >
< / div >
2019-08-05 16:47:52 +12:00
< / li >
< / ul >
< / div >
< div class = "clear" >
2019-08-06 16:19:16 +12:00
< div data-ui-modal class = "modal close box" data-button-text = "Add Webhook" >
2019-08-05 16:47:52 +12:00
< button type = "button" class = "close pull-end" data-ui-modal-close = "" > < i class = "icon-cancel" > < / i > < / button >
< h1 > Add Webhook< / h1 >
2019-08-08 06:10:53 +12:00
< form
data-service="projects.createWebhook"
data-scope="console"
data-event="submit"
data-success="alert,trigger,reset"
data-success-param-alert-text="Created webhook successfully"
data-success-param-trigger-events="webhook-create,modal-close"
2019-08-08 17:09:49 +12:00
data-failure="alert"
2019-08-09 01:43:24 +12:00
data-failure-param-alert-text="Failed to create webhook"
data-failure-param-alert-classname="error">
2019-08-05 16:47:52 +12:00
< input type = "hidden" name = "projectId" data-ls-bind = "{{console-project.$uid}}" >
< label for = "name" > Name< / label >
< input type = "text" class = "full-width" id = "name" name = "name" required autocomplete = "off" / >
< label for = "events" > Events< / label >
< div class = "row thin margin-bottom" >
<?php foreach ( $events as $i => $event ) : ?>
< div class = "col span-6" >
< input type = "checkbox" name = "events" value = " <?php echo $event ; ?> " /> <?php echo $event ; ?>
< / div >
<?php if (( $i + 1 ) % 2 === 0 ) : ?>
< / div >
< div class = "row thin margin-bottom" >
<?php endif ; ?>
<?php endforeach ; ?>
< / div >
< label for = "url" > POST URL< / label >
< input type = "url" class = "full-width" id = "url" name = "url" required autocomplete = "off" placeholder = "https://example.com/callback" / >
2019-08-09 18:40:52 +12:00
< div class = "margin-bottom toggle" data-ls-ui-open >
< i class = "icon-plus pull-end margin-top-tiny" > < / i >
< i class = "icon-minus pull-end margin-top-tiny" > < / i >
< h2 class = "margin-bottom" >
Advanced Options
< small class = "note text-size-small" > (optional)< / small >
< / h2 >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< label for = "secure" > SSL / TLS< / label >
< p class = "note" > Certificate verification< / p >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< input name = "security" data-ls-attrs = "id=secure-yes" type = "radio" value = "1" checked = "checked" required / > < span > Enabled< / span >
< input name = "security" data-ls-attrs = "id=secure-no" type = "radio" value = "0" required / > < span > Disabled< / span >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< br / >
< br / >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< p class = "note margin-bottom" > < span class = "tag red" > Warning< / span > Untrusted or self-signed certificates may not be secure.
< a href = "https://en.wikipedia.org/wiki/Self-signed_certificate" target = "_blank" rel = "noopener" > Learn more< i class = "icon-link-ext" > < / i > < / a >
< / p >
2019-08-05 16:47:52 +12:00
2019-08-09 18:40:52 +12:00
< h3 > HTTP Authentication < span class = "tooltip" data-tooltip = "Use to secure your endpoint from untrusted sources" > < i class = "icon-question" > < / i > < / span > < small > (optional)< / small > < / h3 >
< div class = "row thin" >
< div class = "col span-6" >
< label for = "httpUser" > User< / label >
< input type = "text" class = "full-width" id = "httpUser" name = "httpUser" autocomplete = "off" / >
< / div >
< div class = "col span-6" >
< label for = "httpPass" > Password< / label >
< input type = "password" class = "full-width" id = "httpPass" name = "httpPass" autocomplete = "off" / >
< / div >
2019-08-05 16:47:52 +12:00
< / div >
< / div >
2019-08-06 16:19:16 +12:00
< button type = "submit" > Create< / button > < button data-ui-modal-close = "" type = "button" class = "reverse" > Cancel< / button >
2019-08-05 16:47:52 +12:00
< / form >
< / div >
< / div >
< / div >