243 lines
No EOL
13 KiB
PHTML
243 lines
No EOL
13 KiB
PHTML
<?php
|
|
|
|
$events = [
|
|
'database.collections.create',
|
|
'database.collections.update',
|
|
'database.collections.delete',
|
|
'database.documents.create',
|
|
'database.documents.update',
|
|
'database.documents.delete',
|
|
'storage.files.create',
|
|
'storage.files.update',
|
|
'storage.files.delete',
|
|
// 'auth.register',
|
|
// 'auth.confirm',
|
|
// 'auth.login',
|
|
// 'auth.logout',
|
|
'account.create',
|
|
'account.update.email',
|
|
'account.update.name',
|
|
'account.update.password',
|
|
'account.update.prefs',
|
|
'account.delete',
|
|
];
|
|
|
|
?>
|
|
<div class="cover margin-bottom-large">
|
|
<h1 class="zone xl margin-bottom-large margin-top">
|
|
Webhooks
|
|
</h1>
|
|
</div>
|
|
|
|
<div class="zone xl"
|
|
data-service="projects.listWebhooks"
|
|
data-scope="console"
|
|
data-event="load,projects.createWebhook,projects.updateWebhook,projects.deleteWebhook"
|
|
data-name="console-webhooks"
|
|
data-param-project-id="{{router.params.project}}"
|
|
data-success="trigger"
|
|
data-success-param-trigger-events="projects.listWebhooks">
|
|
|
|
<div data-ls-if="0 == {{console-webhooks.length}} || undefined == {{console-webhooks.length}}" class="box margin-top margin-bottom" style="display: none;">
|
|
<h3 class="margin-bottom-small text-bold-2">No Webhooks Found</h3>
|
|
|
|
<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>
|
|
|
|
<form
|
|
data-analytics-event="submit"
|
|
data-analytics-category="console"
|
|
data-analytics-label="Update Project Webhook"
|
|
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="projects.updateWebhook,modal-close"
|
|
data-failure="alert"
|
|
data-failure-param-alert-text="Failed to update webhook"
|
|
data-failure-param-alert-classname="error">
|
|
|
|
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
|
<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">
|
|
<input type="checkbox" name="events" data-ls-bind="{{webhook.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 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}}" />
|
|
|
|
<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="text-size-small">(optional)</small>
|
|
</h2>
|
|
|
|
<label data-ls-attrs="for=security-{{task.$uid}}" class="margin-bottom-small">
|
|
<div class="margin-bottom-small text-bold">SSL / TLS (Certificate verification)</div>
|
|
|
|
<input name="security" type="radio" required data-ls-attrs="id=secure-yes-{{webhook.$uid}}" data-ls-bind="{{webhook.security}}" value="1" /> <span>Enabled</span>
|
|
<input name="security" type="radio" required data-ls-attrs="id=secure-no-{{webhook.$uid}}" data-ls-bind="{{webhook.security}}" value="0" /> <span>Disabled</span>
|
|
</label>
|
|
|
|
<p class="margin-bottom text-size-small text-fade"><span class="text-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>
|
|
|
|
<label class="text-bold">HTTP Authentication <span class="tooltip" data-tooltip="Use to secure your endpoint from untrusted sources"><i class="icon-question"></i></span> <small>(optional)</small></label>
|
|
|
|
<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 margin-bottom-no" 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 margin-bottom-no" data-ls-attrs="id=httpPass-{{webhook.$uid}}" name="httpPass" autocomplete="off" data-ls-bind="{{webhook.httpPass}}" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit">Save</button> <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
|
|
</form>
|
|
</div>
|
|
|
|
<form class="pull-end margin-end"
|
|
data-analytics-event="submit"
|
|
data-analytics-category="console"
|
|
data-analytics-label="Delete Project Webhook"
|
|
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="projects.deleteWebhook"
|
|
data-failure="alert"
|
|
data-failure-param-alert-text="Failed to delete webhook"
|
|
data-failure-param-alert-classname="error">
|
|
|
|
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
|
<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;">
|
|
<small class="text-danger">(SSL/TLS Disabled)</small>
|
|
</span>
|
|
<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>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
|
|
<div class="clear">
|
|
<div data-ui-modal class="modal close box" data-button-text="Add Webhook">
|
|
<button type="button" class="close pull-end" data-ui-modal-close=""><i class="icon-cancel"></i></button>
|
|
|
|
<h1>Add Webhook</h1>
|
|
|
|
<form
|
|
data-analytics-event="submit"
|
|
data-analytics-category="console"
|
|
data-analytics-label="Create Project Webhook"
|
|
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="projects.createWebhook,modal-close"
|
|
data-failure="alert"
|
|
data-failure-param-alert-text="Failed to create webhook"
|
|
data-failure-param-alert-classname="error">
|
|
|
|
<input type="hidden" name="projectId" data-ls-bind="{{router.params.project}}" />
|
|
|
|
<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" />
|
|
|
|
<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="text-size-small">(optional)</small>
|
|
</h2>
|
|
|
|
<label data-ls-attrs="for=security-{{task.$uid}}" class="margin-bottom-small">
|
|
<div class="margin-bottom-small text-bold">SSL / TLS (Certificate verification)</div>
|
|
|
|
<input name="security" type="radio" required data-ls-attrs="id=secure-yes" checked="checked" value="1" /> <span>Enabled</span>
|
|
<input name="security" type="radio" required data-ls-attrs="id=secure-no" value="0" /> <span>Disabled</span>
|
|
</label>
|
|
|
|
<p class="margin-bottom text-size-small text-fade"><span class="text-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>
|
|
|
|
<label class="text-bold">HTTP Authentication <span class="tooltip" data-tooltip="Use to secure your endpoint from untrusted sources"><i class="icon-question"></i></span> <small>(optional)</small></label>
|
|
|
|
<div class="row thin">
|
|
<div class="col span-6">
|
|
<label for="httpUser">User</label>
|
|
<input type="text" class="full-width margin-bottom-no" id="httpUser" name="httpUser" autocomplete="off" />
|
|
</div>
|
|
<div class="col span-6">
|
|
<label for="httpPass">Password</label>
|
|
<input type="password" class="full-width margin-bottom-no" id="httpPass" name="httpPass" autocomplete="off" />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<button type="submit">Create</button> <button data-ui-modal-close="" type="button" class="reverse">Cancel</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|