replace zxq.co/ripple/hanayo

This commit is contained in:
Alicia
2019-02-23 13:29:15 +00:00
commit c3d206c173
5871 changed files with 1353715 additions and 0 deletions

View File

@@ -0,0 +1,91 @@
{{/*###
Handler=/settings/2fa
TitleBar=Two Factor Authentication
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
{{ $e := is2faEnabled .Context.User.ID }}
{{ if $e }}
<div class="ui success message">
{{ .T "Two factor authentication is enabled on your account." }}
</div>
{{ else }}
<div class="ui warning message">
{{ .T "Two factor authentication is not enabled on your account." }}
</div>
{{ end }}
<div class="ui segments">
{{ if eq $e 0 }}
<div class="ui segment">
<h1 class="ui header">
{{ .T "Google Authenticator (TOTP) based 2FA" }}
</h1>
{{ $k := generateKey .Context }}
<div class="ui compact centered segment" style="margin: 0 auto; display: table">
<img src="https://chart.googleapis.com/chart?chs=256x256&cht=qr&chl=otpauth://totp/{{ $k.AccountName }}%3Fsecret={{ $k.Secret }}%26issuer={{ $k.Issuer }}">
</div>
<p class="little top margin">
{{ .T "Scan this from <a href=\"https://support.google.com/accounts/answer/1066447?hl=en\">Google Authenticator</a>, or if you're not able to, provide to Google Authenticator this key: <code>%s</code>. Once you've done, fill out the following form with the code you get on Google Authenticator and click on enter to enable TOTP-based two factor authentication." $k.Secret | html }}
</p>
<form class="ui form" action="/settings/2fa/totp" method="POST">
{{ csrfGenerate .Context.User.ID }}
{{ ieForm .Gin }}
<div class="ui fluid action input">
<input tabindex="1" type="text" placeholder="612 116" name="passcode">
<button tabindex="2" class="ui right labeled icon blue button">
<i class="right arrow icon"></i>
{{ .T "Submit" }}
</button>
</div>
</form>
</div>
{{ else }}
<div class="ui segment">
<p>
{{ if eq $e 1 }}
{{ .T "At the moment you currently have set up Telegram Two Factor Authentication. Should you wish to disable it, please fill out the following form:" }}
{{ else }}
{{ .T "At the moment you currently have set up TOTP-based (Google Authenticator) Two Factor Authentication. Should you wish to disable it, please fill out the following form:" }}
{{ end }}
</p>
<form action="/settings/2fa/disable" method="POST" class="centered">
{{ csrfGenerate .Context.User.ID }}
{{ ieForm .Gin }}
<div class="ui fluid action input">
<input tabindex="1" name="password" type="password" placeholder="Password">
<button tabindex="2" type="submit" class="ui red right labeled icon button">
<i class="ban icon"></i>
{{ if eq $e 1 }}{{ .T "Disable Telegram 2FA" }}{{ else }}{{ .T "Disable TOTP-based 2FA" }}{{ end }}
</button>
</div>
</form>
</div>
{{ if eq $e 2 }}
<div class="ui segment">
<h1 class="ui header">
{{ .T "Google Authenticator recovery keys" }}
</h1>
<p>
{{ .T "These are the only thing that will let you get back into your Ripple account if you lose your device. Our suggestion is to paste them inside a document in your word processor (Microsoft Word, LibreOffice Writer), print them and store them in a safe place." }}
</p>
<div class="ui four column grid">
{{ range getKeys .Context.User.ID }}
<div class="ui column">
{{ . }}
</div>
{{ end }}
</div>
</div>
{{ end }}
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,51 @@
{{/*###
TitleBar=Authorized applications
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
{{ .T "From here you can check all the applications you granted authorization to your account, and revoke their permissions if necessary." }}
<div class="ui divider"></div>
{{ $csrf := csrfGenerate .Context.User.ID }}
{{ with .RequestInfo.apps }}
<table class="ui very basic fixed table">
{{ range . }}
<tr>
<td class="avatar-cell">
{{ if .Avatar }}
<img src="/static/oauth-apps/{{ .Avatar }}" class="ui tiny rounded image">
{{ end }}
</td>
<td>
<b>{{ .Name }}</b><br>{{ .Scopes $.Gin }}
<div class="subtitle">{{ $.T "Authorization created %s" (timeFromTime .CreatedAt) | html }}</div>
</td>
<td class="right aligned">
<div class="ui vertical buttons">
<form method="POST" action="/settings/authorized_applications/revoke">
<a class="ui labeled icon blue button" href="/u/{{ .Owner }}"><i class="user icon"></i>{{ $.T "Owner" }}</a>
<input type="hidden" name="client_id" value="{{ .Client }}">
{{ $csrf }}
{{ ieForm $.Gin }}
<button type="submit" class="ui labeled icon red button"><i class="remove icon"></i>{{ $.T "Revoke" }}</button>
</form>
</div>
</td>
</tr>
{{ end }}
</table>
{{ else }}
{{ $.T "... but it looks like you have none!" }}
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,35 @@
{{/*###
Handler=/settings/avatar
TitleBar=Avatar
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui center aligned segment">
<div class="ui compact segment" style="margin: 0 auto;">
<img src="{{ config "AvatarURL" }}/{{ .Context.User.ID }}" alt="Avatar" id="avatar-img" style="max-width: 400px;">
</div>
<form action="/settings/avatar" method="post" enctype="multipart/form-data" class="little top margin">
{{ ieForm .Gin }}
<div class="ui buttons">
<label tabindex="1" for="file" class="ui green labeled icon button">
<i class="file icon"></i>
{{ .T "Open File" }}
</label>
<button tabindex="2" type="submit" class="ui right labeled blue icon button">
<i class="save icon"></i>
{{ .T "Save" }}
</button>
</div>
<input type="file" id="file" style="display:none" required accept="image/*" name="avatar">
</form>
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,41 @@
{{/*###
Handler=/settings/discord
TitleBar=Discord donor
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=6
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
{{ $q := qb "SELECT discordid FROM discord_roles WHERE userid = ? LIMIT 1" .Context.User.ID }}
{{ if $q.discordid }}
<p>
{{ .T "Your discord account has been linked to this Ripple account. <b>Welcome to the donors club and thank you for supporting us!</b> You have now access to the #donators text and voice channels on our official Discord server! You can also set a custom role name and username colour and change your nickname on Discord. If you want to change your nickname, you can use the <code>/nick</code> command. To set or edit your <b>custom role</b> name and colour, use the command <code>!role HEX_COLOUR ROLE_NAME</code>. You can pick your HEX colour <a href=\"http://www.colorpicker.com/\" target=\"_blank\">here</a>, it's the one that starts with '#'. You can change your role name and colour <b>whenever you want!</b>" | html }}
</p>
<h2 class="ui centered header">{{ .T "Thank you for supporting us and have fun on Ripple!" }}</h2>
{{ else }}
<p><b>{{ .T "Donors get special privileges on our Discord server too!" }}</b></p>
<p>
{{ .T "Discord is a chatroom with text and voice channels, bots and lots of other cool features. You can <b>download Discord for free <a href=\"http://discord.gg/\" target=\"_blank\">here</a></b> and you can <b>join our official Discord server <a href=\"%s\" target=\"_blank\">here</a></b>." (config "DiscordServer") | html }}
</p>
<p>{{ .T "Here's what you get if you link your Discord account:" }}</p>
<ul class="ui list">
<li>{{ .T "Access to /nick command, to change your Discord nickname" }}</li>
<li>{{ .T "Access to #donators text and voice channels" }}</li>
<li>{{ .T "Username on donors list" }}</li>
<li>{{ .T "Custom role with custom username" }}</li>
</ul>
<p>{{ .T "To get these perks, first of all <a href=\"%s\" target=\"_blank\">join our Discord server</a>, then click this fancy button:" (config "DiscordServer") | html }}</p>
<p class="centered">
<a tabindex="1" class="ui red labeled icon button" href="{{ authCodeURL .Context.User.ID }}"><i class="heart icon"></i> {{ .T "Get Discord donor privileges" }}</a>
</p>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,28 @@
{{/*###
NoCompile=true
*/}}
{{ define "settingsSidebar" }}
<div class="four wide column">
<div class="ui fluid vertical menu">
{{ navbarItem .Path (.T "Profile") "/settings" }}
{{ navbarItem .Path (.T "Userpage") "/settings/userpage" }}
{{ navbarItem .Path (.T "Avatar") "/settings/avatar" }}
{{ navbarItem .Path (.T "Password") "/settings/password" }}
{{ navbarItem .Path (.T "Two Factor Authentication") "/settings/2fa" }}
{{ navbarItem .Path (.T "Authorized applications") "/settings/authorized_applications" }}
{{/* Stuff for donators */}}
{{ if has .Context.User.Privileges 4 }}
{{ navbarItem .Path (.T "Discord donor") "/settings/discord" }}
{{ navbarItem .Path (.T "Profile background") "/settings/profbackground" }}
{{ end }}
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,36 @@
{{/*###
TitleBar=Password
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
<form class="ui form" method="post">
<div class="field">
<label>{{ .T "Email" }}</label>
<input tabindex="1" type="email" name="email" value="{{ or .FormData.email .RequestInfo.email }}" required>
</div>
<div class="field">
<label>{{ .T "New password (leave blank if you don't want to change it)" }}</label>
<input tabindex="2" type="password" name="newpassword" value="{{ .FormData.newpassword }}">
</div>
<div class="field">
<label>{{ .T "Current password" }}</label>
<input tabindex="3" type="password" name="currentpassword" required>
</div>
{{ csrfGenerate .Context.User.ID }}
{{ ieForm .Gin }}
<div style="text-align: right">
<button tabindex="4" type="submit" class="ui blue button">{{ .T "Save" }}</button>
</div>
</form>
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,75 @@
{{/*###
Handler=/settings/profbackground
TitleBar=Profile background
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=6
AdditionalJS=https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.js
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui center aligned segment">
{{ $d := qb "SELECT type, value FROM profile_backgrounds WHERE uid = ? LIMIT 1" .Context.User.ID }}
{{ $type := or $d.type.Int -1 }}
{{ $value := or $d.value.String "" }}
<p>
<select class="ui dropdown" id="background-type" name="type">
<option value="">{{ .T "Background type" }}</option>
<option value="0">{{ .T "None" }}</option>
<option value="1"{{ if eq $type 1 }} selected{{ end }}>{{ .T "Image" }}</option>
<option value="2"{{ if eq $type 2 }} selected{{ end }}>{{ .T "Solid colour" }}</option>
</select>
</p>
<div class="ui compact segment" id="image-background" style="margin: 0 auto; max-width: 400px; max-height: 700px;" data-type="1"{{ if ne $type 1 }} hidden{{ end }}>
{{ if and (eq $type 1) $value }}
<img src="/static/profbackgrounds/{{ $value }}">
{{ else }}
No image selected
{{ end }}
</div>
{{ $csrf := csrfGenerate .Context.User.ID }}
<form action="/settings/profbackground/0" method="post" class="little top margin ui form" data-type="0"{{ if and (ne $type 0) }} hidden{{ end }}>
{{ $csrf }}
{{ ieForm .Gin }}
<button type="submit" class="ui right labeled blue icon button">
<i class="save icon"></i>
Save
</button>
</form>
<form action="/settings/profbackground/1" method="post" enctype="multipart/form-data" class="little top margin ui form" data-type="1"{{ if ne $type 1 }} hidden{{ end }}>
{{ $csrf }}
<div class="ui buttons">
<label for="file" class="ui green labeled icon button">
<i class="file icon"></i>
{{ .T "Open File" }}
</label>
{{ ieForm .Gin }}
<button type="submit" class="ui right labeled blue icon button">
<i class="save icon"></i>
{{ .T "Save" }}
</button>
</div>
<input type="file" id="file" style="display:none" required accept="image/*" name="value">
</form>
<form action="/settings/profbackground/2" method="post" class="little top margin ui form" data-type="2"{{ if ne $type 2 }} hidden{{ end }}>
{{ $csrf }}
<div class="ui compact segment" style="margin: 0 auto;">
<input type="text"{{ if and (eq $type 2) $value }} value="{{ $value }}"{{ end }} id="colorpicker" name="value">
</div>
<p class="little top margin">
{{ ieForm .Gin }}
<button type="submit" class="ui right labeled blue icon button">
<i class="save icon"></i>
Save
</button>
</p>
</form>
</div>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-minicolors/2.2.4/jquery.minicolors.min.css">
{{ end }}

View File

@@ -0,0 +1,91 @@
{{/*###
Handler=/settings
TitleBar=Settings
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
<form class="ui form" method="post">
{{ $d := .Get "users/self/settings" }}
<h3 class="ui header">{{ .T "General" }}</h3>
<div class="field">
<label><a href="https://support.ripple.moe">{{ .T "Username" }}</a></label>
<input type="text" value="{{ .Context.User.Username }}" disabled>
</div>
<div class="field">
<label>
<a href="/settings/password">{{ .T "Email address" }}</a>
</label>
<input type="email" value="{{ $d.email }}" placeholder="{{ .T "Email address" }}" required disabled>
</div>
<div class="field">
<label>{{ .T "Alternative username (cannot be used for login)" }}</label>
<input type="text" name="username_aka" value="{{ $d.username_aka }}" placeholder="{{ .T "Also known as..." }}">
</div>
<div class="field">
<label>{{ .T "Favourite mode" }}</label>
<select class="ui dropdown" name="favourite_mode" data-cast="int">
{{ range $k, $v := modes }}
<option value="{{ $k }}" {{ if eq (int $d.favourite_mode) $k }}selected{{ end }}>{{ $v }}</a>
{{ end }}
</select>
</div>
{{ if has .Context.User.Privileges 4 }}
<h3 class="ui header">{{ .T "Custom badge" }}</h3>
<div class="ui warning message">
{{ .T "<b>Do not use offensive badges and do not pretend to be someone else with your badge.</b> If you abuse the badges system, you'll be silenced and you won't be able to edit your custom badge anymore." | html}}
</div>
<div class="ui toggle checkbox">
<input type="checkbox" name="custom_badge.show" {{ if $d.custom_badge.show }}checked{{ end }}>
<label>{{ .T "Enable" }}</label>
</div>
<div id="custom-badge-fields" {{ if not $d.custom_badge.show }}style="display: none"{{ end }} class="little top margin">
<p><a href="http://semantic-ui.com/elements/icon.html">{{ .T "Icon reference" }}</a></p>
<div class="ui two column center aligned grid" style="margin-top: 0">
<div class="column">
<i class="circular {{ faIcon $d.custom_badge.icon }} big icon" id="badge-icon"></i><br>
<b id="badge-name">{{ $d.custom_badge.name }}</b>
</div>
<div class="column">
<p><input type="text" name="custom_badge.icon" placeholder="plane, left chevron, hand spock..." value="{{ $d.custom_badge.icon }}"></p>
<p><input type="text" name="custom_badge.name" placeholder="{{ .T "Dinosaur, oompa-loompa, cool guy..." }}" value="{{ $d.custom_badge.name }}"></p>
</div>
</div>
</div>
{{ end }}
<h3 class="ui header">{{ .T "Playstyle" }}</h3>
<div class="ui three column grid" id="checkbox-grid">
{{ $ := . }}
{{ range $k, $v := styles }}
<div class="column">
{{ $checked := band (int $d.play_style) (shift 1 $k) }}
<div class="ui checkbox">
<input type="checkbox" data-sv="{{ shift 1 $k }}" {{ if $checked }}checked{{ end }}>
<label>{{ $.T $v }}</label>
</div>
</div>
{{ end }}
</div>
<h3 class="ui header">{{ .T "Preferences" }}</h3>
{{ $ds := band .ClientFlags 1 }}
<div class="ui checkbox">
<input type="checkbox" {{ if $ds }}checked{{ end }} id="dark-site">
<label>{{ .T "Dark site" }}</label>
</div>
<div class="ui divider"></div>
<div style="text-align: right">
<button type="submit" class="ui blue button">{{ .T "Save" }}</button>
</div>
{{ ieForm .Gin }}
</form>
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,33 @@
{{/*###
Handler=/settings/userpage
TitleBar=Userpage
KyutGrill=settings2.jpg
Include=menu.html
MinPrivileges=2
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "settingsSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
{{ $f := ieForm .Gin }}
{{ with .Get "users/userpage?id=%d" .Context.User.ID }}
<form class="ui form" method="post">
<textarea tabindex="1" class="monospace" name="data">{{ .userpage }}</textarea>
<p><a href="https://docs.ripple.moe/docs/misc/hanayo_bbcode" target="_blank">{{ $.T "BBCode syntax reference" }}</a></p>
<div class="ui divider"></div>
<div class="ui segment twemoji" id="userpage-content">{{ parseUserpage .userpage | html }}</div>
<div class="ui divider"></div>
<div style="text-align: right">
<button type="submit" class="ui blue button">{{ $.T "Save" }}</button>
</div>
{{ $f }}
</form>
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}