Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webui): increase roll difficulties #208

Merged
merged 1 commit into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
# VALENTINA_WEBUI_ACCESS_LOG=/valentina/access.log

# Enables Cloudflare Web Analytics by setting this to your Cloudflare Web Analytics token
# VALENTINA_CLOUDFLARE_WEB_ANALYTICS_TOKEN=
# VALENTINA_CLOUDFLARE_ANALYTICS_TOKEN=

# Enables Google Analytics by setting this to your Google Analytics ID
# VALENTINA_GOOGLE_ANALYTICS_ID=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Settings for Valentina are controlled by environment variables. The following is
| VALENTINA_DISCORD_OAUTH_CLIENT_ID | | Sets the ID for the Discord OAuth. This is required to run the web UI. |
| VALENTINA_WEBUI_BEHIND_REVERSE_PROXY | `false` | Set to `true` if the web UI is behind a reverse proxy. |
| VALENTINA_WEBUI_ACCESS_LOG | `/valentina/access.log` | Sets the file to write access logs to.<br />Note, this is the directory used within the Docker container |
| VALENTINA_CLOUDFLARE_WEB_ANALYTICS_TOKEN | | Optional: Enable Cloudflare Web Analytics by setting this to your Cloudflare Web Analytics token |
| VALENTINA_CLOUDFLARE_ANALYTICS_TOKEN | | Optional: Enable Cloudflare Web Analytics by setting this to your Cloudflare Web Analytics token |
| VALENTINA_GOOGLE_ANALYTICS_ID | | Optional: Enable Google Analytics by setting this to your Google Analytics ID |

---
Expand Down
2 changes: 1 addition & 1 deletion src/valentina/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class ValentinaConfig(BaseConfig): # type: ignore [misc]
redis_addr: str = "127.0.0.1:6379"
webui_secret_key: str = ""
webui_behind_reverse_proxy: ENV_BOOLEAN = False
cloudflare_web_analytics_token: str = ""
cloudflare_analytics_token: str = ""
google_analytics_id: str = ""

CONFIG_SOURCES: ClassVar[ConfigSources | None] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</div>
<div class="row">
<div class="col">
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" form={{ form }} />
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" min-val="0" max-val="10" form={{ form }} />
</div>
{% if campaign %}
<div class="col">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<global.valentinaform.Increment label="Dice Pool" name="pool" start-val="1" form={{ form }} />
</div>
<div class="col">
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" form={{ form }} />
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" min-val="0" max-val="10" form={{ form }} />
</div>
</div>
{% if campaign %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
</div>
<div class="row">
<div class="col">
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" form={{ form }} />
<global.valentinaform.Increment label="Difficulty" name="difficulty" start-val="6" min-val="0" max-val="10" form={{ form }} />
</div>
{% if campaign %}
<div class="col">
Expand Down
7 changes: 6 additions & 1 deletion src/valentina/webui/blueprints/oauth/blueprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@ async def callback() -> Any: # pragma: no cover
abort(HTTPStatus.BAD_REQUEST.value, f"User {oauth_user.name} is not in any known guilds.")

if len(matched_guilds) == 1:
logger.info(f"User {oauth_user.name} is in one known guild: {matched_guilds[0]["id"]}.")
logger.info(
f"User {oauth_user.name} is known to one guild: {matched_guilds[0]["id"]}. Logging in."
)
session["GUILD_ID"] = matched_guilds[0]["id"]
await update_session()
return redirect(url_for("homepage.homepage"))

session["matched_guilds"] = matched_guilds
logger.info(
f"User {oauth_user.name} is known to multiple guilds. Redirecting to guild selection before log in."
)
return redirect(url_for("homepage.select_guild"))
2 changes: 1 addition & 1 deletion src/valentina/webui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Config:
DISCORD_CLIENT_SECRET = ValentinaConfig().discord_oauth_secret
DISCORD_REDIRECT_URI = f"{ValentinaConfig().webui_base_url}/callback"
DISCORD_BOT_TOKEN = ValentinaConfig().discord_token
CLOUDFLARE_WEB_ANALYTICS_TOKEN = ValentinaConfig().cloudflare_web_analytics_token
CLOUDFLARE_ANALYTICS_TOKEN = ValentinaConfig().cloudflare_analytics_token
GOOGLE_ANALYTICS_ID = ValentinaConfig().google_analytics_id


Expand Down
4 changes: 2 additions & 2 deletions src/valentina/webui/shared/PageLayout.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,11 @@
var toastE = new bootstrap.Toast(toast);
toastE.show();
</script>
{% if config.CLOUDFLARE_WEB_ANALYTICS_TOKEN %}
{% if config.CLOUDFLARE_ANALYTICS_TOKEN %}
<!-- Cloudflare Web Analytics -->
<script defer
src='https://static.cloudflareinsights.com/beacon.min.js'
data-cf-beacon='{"token": "{{ config.CLOUDFLARE_WEB_ANALYTICS_TOKEN }}"}'></script>
data-cf-beacon='{"token": "{{ config.CLOUDFLARE_ANALYTICS_TOKEN }}"}'></script>
<!-- End Cloudflare Web Analytics -->
{% endif %}
</body>
Expand Down
Loading