Compare commits

...

2 Commits

Author SHA1 Message Date
1d01368570
Add webhook ID to asset restriction model 2023-02-10 21:13:12 +00:00
101a4933c9
Make long IDs copyable 2023-02-10 21:13:00 +00:00
5 changed files with 48 additions and 2 deletions

View File

@ -31,6 +31,7 @@ REGISTRATION_OPEN = getenv("REGISTRATION_OPEN", "false").lower() in trues
# Hook URL, do not include leading or trailing slash
HOOK_PATH = "hook"
ASSET_PATH = "asset"
NOTIFY_TOPIC = getenv("NOTIFY_TOPIC", "great-fisk")
@ -51,4 +52,4 @@ if DEBUG:
"10.0.2.2",
]
SETTINGS_EXPORT = ["STRIPE_ENABLED", "URL", "HOOK_PATH"]
SETTINGS_EXPORT = ["STRIPE_ENABLED", "URL", "HOOK_PATH", "ASSET_PATH"]

View File

@ -0,0 +1,24 @@
# Generated by Django 4.1.6 on 2023-02-10 21:07
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('core', '0053_assetrestriction_pairs_parsed_and_more'),
]
operations = [
migrations.AddField(
model_name='assetrestriction',
name='webhook_id',
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
),
migrations.AlterField(
model_name='assetgroup',
name='allowed',
field=models.JSONField(blank=True, default=dict, null=True),
),
]

View File

@ -1,3 +1,4 @@
import uuid
from datetime import timedelta
import stripe
@ -439,6 +440,8 @@ class AssetRestriction(models.Model):
pairs = models.CharField(max_length=4096, null=True, blank=True)
pairs_parsed = models.JSONField(null=True, blank=True)
webhook_id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
group = models.ForeignKey(
AssetGroup, on_delete=models.CASCADE, null=True, blank=True
)

View File

@ -14,6 +14,7 @@
<th>description</th>
<th>pairs</th>
<th>group</th>
<th>hook</th>
<th>actions</th>
</thead>
{% for item in object_list %}
@ -24,6 +25,15 @@
<td>{{ item.description }}</td>
<td>{{ item.pairs_parsed|length }}</td>
<td>{{ item.group }}</td>
<td>
<a
class="has-text-grey"
onclick="window.prompt('Copy to clipboard: Ctrl+C, Enter', '{{settings.URL}}/{{settings.ASSET_PATH}}/{{ item.webhook_id }}');">
<span class="icon" data-tooltip="Copy to clipboard">
<i class="fa-solid fa-copy" aria-hidden="true"></i>
</span>
</a>
</td>
<td>
<div class="buttons">
<button

View File

@ -20,7 +20,15 @@
<td>{{ item.id }}</td>
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td><code>{{settings.URL}}/{{settings.HOOK_PATH}}/{{ item.hook }}/</code></td>
<td>
<a
class="has-text-grey"
onclick="window.prompt('Copy to clipboard: Ctrl+C, Enter', '{{settings.URL}}/{{settings.HOOK_PATH}}/{{ item.hook }}');">
<span class="icon" data-tooltip="Copy to clipboard">
<i class="fa-solid fa-copy" aria-hidden="true"></i>
</span>
</a>
</td>
<td>{{ item.received }}</td>
<td>
<div class="buttons">