WIP
This commit is contained in:
.vscode
config
core
requirements.txttwitch/migrations
0002_alter_dropcampaign_options_alter_dropcampaign_game_and_more.py0003_channel_added_at_channel_modified_at_and_more.py0004_alter_dropcampaign_options.py
twitch_app
206
core/templates/add_discord_webhook.html
Normal file
206
core/templates/add_discord_webhook.html
Normal file
@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<meta name="description" content="Twitch Drops">
|
||||
<meta name="author" content="TheLovinator">
|
||||
<meta name="keywords" content="Twitch, Drops, Twitch Drops">
|
||||
<meta name="robots" content="index, follow">
|
||||
<title>Add Discord Webhook</title>
|
||||
<style>
|
||||
:root {
|
||||
--background-color: #121212;
|
||||
--text-color: #e0e0e0;
|
||||
--header-background: #1e1e1e;
|
||||
--border-color: #333;
|
||||
--button-background: #6441a5;
|
||||
--button-hover-background: #503682;
|
||||
--button-shadow: rgba(0, 0, 0, 0.2);
|
||||
--button-padding: 0.5rem 1rem;
|
||||
--button-margin: 0.5rem 0;
|
||||
--button-radius: 0.5rem;
|
||||
--button-font-size: 0.875rem;
|
||||
--input-background: #2a2a2a;
|
||||
--input-border: #444;
|
||||
--input-focus-border: #6441a5;
|
||||
--input-padding: 0.5rem;
|
||||
--input-radius: 0.5rem;
|
||||
--form-gap: 1rem;
|
||||
}
|
||||
|
||||
html {
|
||||
max-width: 88ch;
|
||||
padding: calc(1vmin + 0.5rem);
|
||||
margin-inline: auto;
|
||||
font-size: clamp(1em, 0.909em + 0.45vmin, 1.25em);
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 10px 30px;
|
||||
background: var(--header-background);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.game {
|
||||
margin-bottom: 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
img {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: var(--button-background);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: var(--button-padding);
|
||||
margin: var(--button-margin);
|
||||
border-radius: var(--button-radius);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease, box-shadow 0.3s ease;
|
||||
font-size: var(--button-font-size);
|
||||
box-shadow: 0 2px 4px var(--button-shadow);
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: var(--button-hover-background);
|
||||
box-shadow: 0 3px 6px var(--button-shadow);
|
||||
}
|
||||
|
||||
.navbar {
|
||||
margin-bottom: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo {
|
||||
text-align: center;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.messages {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
margin-bottom: var(--form-gap);
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.success {
|
||||
color: green;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--form-gap);
|
||||
background-color: var(--header-background);
|
||||
padding: 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
form div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
label {
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
input, select, textarea {
|
||||
background-color: var(--input-background);
|
||||
border: 1px solid var(--input-border);
|
||||
padding: var(--input-padding);
|
||||
|
||||
color: var(--text-color);
|
||||
transition: border-color 0.3s ease;
|
||||
}
|
||||
|
||||
input:focus, select:focus, textarea:focus {
|
||||
border-color: var(--input-focus-border);
|
||||
outline: none;
|
||||
}
|
||||
|
||||
small {
|
||||
color: #aaa;
|
||||
margin-top: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% if messages %}
|
||||
<ul class="messages">
|
||||
{% for message in messages %}
|
||||
<li {% if message.tags %}class="{{ message.tags }}"{% endif %}>{{ message }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<h1 class="logo">
|
||||
<a href="{% url 'core:index' %}">Twitch Drops</a>
|
||||
</h1>
|
||||
<div class="navbar">
|
||||
<a href='{% url "api-1.0.0:openapi-view" %}'>API</a> |
|
||||
<a href="https://github.com/sponsors/TheLovinator1">Donate</a> |
|
||||
TheLovinator#9276
|
||||
</div>
|
||||
<h1>Add Discord Webhook</h1>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.non_field_errors }}
|
||||
<div>
|
||||
{{ form.name.errors }}
|
||||
<label for="{{ form.name.id_for_label }}">{{ form.name.label_tag }}</label>
|
||||
{{ form.name }}
|
||||
<small>{{ form.name.help_text }}</small>
|
||||
</div>
|
||||
<div>
|
||||
{{ form.webhook_url.errors }}
|
||||
<label for="{{ form.webhook_url.id_for_label }}">{{ form.webhook_url.label_tag }}</label>
|
||||
{{ form.webhook_url }}
|
||||
<small>{{ form.webhook_url.help_text }}</small>
|
||||
</div>
|
||||
<button type="submit">Add Webhook</button>
|
||||
</form>
|
||||
<h2>Webhooks</h2>
|
||||
<ul>
|
||||
{% for webhook in webhooks %}
|
||||
<li>
|
||||
<form method="post" action="{% url 'core:delete_discord_webhook' %}">
|
||||
<strong>{{ webhook.name }}</strong>
|
||||
<small>
|
||||
<a href="{{ webhook.webhook_url }}">{{ webhook.webhook_url }}</a>
|
||||
</small>
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="webhook_id" value="{{ webhook.id }}">
|
||||
<input type="hidden" name="webhook_name" value="{{ webhook.name }}">
|
||||
<input type="hidden" name="webhook_url" value="{{ webhook.webhook_url }}">
|
||||
<button type="submit">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +1,4 @@
|
||||
{% load socialaccount %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@ -17,9 +18,13 @@
|
||||
--border-color: #333;
|
||||
--button-background: #6441a5;
|
||||
--button-hover-background: #503682;
|
||||
--button-shadow: rgba(0, 0, 0, 0.2);
|
||||
--button-padding: 0.5rem 1rem;
|
||||
--button-margin: 0.5rem 0;
|
||||
--button-radius: 0.5rem;
|
||||
--button-font-size: 0.875rem;
|
||||
}
|
||||
|
||||
/* Set some good defaults for the page */
|
||||
html {
|
||||
max-width: 88ch;
|
||||
padding: calc(1vmin + 0.5rem);
|
||||
@ -30,76 +35,67 @@
|
||||
color: var(--text-color);
|
||||
}
|
||||
|
||||
/* Don't underline links and remove the blue/purple color */
|
||||
a {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/* Add a gray background for the game name header */
|
||||
/* This header also contains the button to subscribe to the game */
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between; /* So the button is on the right, and the game name is on the left */
|
||||
padding: 10px 30px;
|
||||
background: var(--header-background);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
/* Remove dot in front of list items */
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Add a border around each game to separate them */
|
||||
|
||||
.game {
|
||||
margin-bottom: 1rem;
|
||||
border: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
/* Move images away from the border */
|
||||
|
||||
img {
|
||||
margin: 10px;
|
||||
}
|
||||
|
||||
/* Button to subscribe to a game */
|
||||
/* For example: Subscribe to Rocket League */
|
||||
|
||||
button {
|
||||
background-color: var(--button-background);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 5px;
|
||||
padding: var(--button-padding);
|
||||
margin: var(--button-margin);
|
||||
border-radius: var(--button-radius);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
}
|
||||
|
||||
/* Make button darker when hovered */
|
||||
button:hover {
|
||||
background-color: var(--button-hover-background);
|
||||
transition: background-color 0.3s ease, box-shadow 0.3s ease;
|
||||
font-size: var(--button-font-size);
|
||||
box-shadow: 0 2px 4px var(--button-shadow);
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: var(--button-hover-background);
|
||||
box-shadow: 0 3px 6px var(--button-shadow);
|
||||
}
|
||||
|
||||
/* Navbar at the top of the page */
|
||||
.navbar {
|
||||
margin-bottom: 1rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Make the logo bigger and bolder and center it */
|
||||
.logo {
|
||||
text-align: center;
|
||||
font-size: 2.5rem;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Django messages framework */
|
||||
|
||||
.messages {
|
||||
list-style-type: none;
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
/* Make error messages red and success messages green */
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
@ -121,19 +117,34 @@
|
||||
<div class="navbar">
|
||||
<a href='{% url "api-1.0.0:openapi-view" %}'>API</a> |
|
||||
<a href="https://github.com/sponsors/TheLovinator1">Donate</a> |
|
||||
TheLovinator#9276
|
||||
TheLovinator#9276 |
|
||||
{% if user.is_authenticated %}
|
||||
<a href='{% url "account_logout" %}'>Logout</a>
|
||||
{% else %}
|
||||
<a href='{% provider_login_url "twitch" %}'>Login</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% for organization, org_data in orgs_data.items %}
|
||||
<ul>
|
||||
{% for game, game_data in org_data.games.items %}
|
||||
<li class="game">
|
||||
<header>
|
||||
<img src="{{ game.image_url }}"
|
||||
alt="{{ game.display_name }}"
|
||||
height="100"
|
||||
width="100"
|
||||
loading="lazy">
|
||||
<h2>
|
||||
<a href="https://www.twitch.tv/directory/category/{{ game.slug }}">{{ game.display_name }}</a>
|
||||
</h2>
|
||||
<form action="" method="post">
|
||||
<form action='{% url "core:subscription_create" %}' method="post">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="game_id" value="{{ game.id }}">
|
||||
<select name="discord_webhook">
|
||||
{% for discord_setting in discord_settings %}
|
||||
<option value="{{ discord_setting.id }}">{{ discord_setting.name }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<button type="submit">Subscribe to {{ game.display_name }}</button>
|
||||
</form>
|
||||
<form action='{% url "core:test" %}' method="post">
|
||||
@ -150,7 +161,8 @@
|
||||
<img src="{{ drop_benefit.image_asset_url }}"
|
||||
alt="{{ drop_benefit.name }}"
|
||||
height="100"
|
||||
width="100">
|
||||
width="100"
|
||||
loading="lazy">
|
||||
<a href="{{ drop_benefit.details_url }}">{{ drop_benefit.name }}</a>
|
||||
</li>
|
||||
{% endfor %}
|
||||
|
Reference in New Issue
Block a user