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

43
templates/dev/apps.html Normal file
View File

@@ -0,0 +1,43 @@
{{/*###
TitleBar=Your OAuth2 Applications
KyutGrill=dev.jpg
MinPrivileges=2
Include=menu.html
HugeHeadingRight=true
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "devSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
From this page you can create, modify and delete your API applications that use OAuth 2.
<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 }}
<a href="/dev/apps/edit?id={{ .ID }}" title="Edit"><img src="/static/oauth-apps/{{ .Avatar }}" alt="Avatar" class="ui tiny rounded image"></a>
{{ end }}
</td>
<td>
<a href="/dev/apps/edit?id={{ .ID }}" title="Edit"><b>{{ .Name }}</b></a>
<div class="subtitle">{{ .ID }}</div>
</td>
</tr>
{{ end }}
</table>
<div class="ui divider"></div>
{{ end }}
<div class="little margin top right aligned">
<a class="ui blue labeled icon button" href="/dev/apps/edit?id=new"><i class="plus icon"></i>Create new</a>
</div>
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,65 @@
{{/*###
TitleBar=Edit OAuth 2 Application
KyutGrill=dev.jpg
MinPrivileges=2
Include=menu.html
HugeHeadingRight=true
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "devSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
{{ $app := .RequestInfo.app }}
{{ $id := .Gin.Query "id" }}
{{ if $app }}
{{ if $app.ID }}
<div class="centered">
{{ with $app.Avatar }}
<img src="/static/oauth-apps/{{ . }}" alt="Avatar" class="ui small rounded image" style="margin: 0 auto;">
{{ end }}
<h2 class="ui header little top margin"><code>{{ $app.ID }}</code></h2>
</div>
<div class="ui divider"></div>
{{ end }}
<form class="ui form" method="POST" enctype="multipart/form-data" action="/dev/apps/edit" id="edit-form">
<div class="field">
<label>Name</label>
<input type="text" name="name" value="{{ $app.Name }}" maxlength="25">
</div>
<div class="field">
<label>Redirect URI</label>
<input name="redirect_uri" value="{{ $app.RedirectURI }}" maxlength="255">
</div>
<div class="field">
<label>Avatar</label>
<input name="avatar" type="file">
</div>
<input type="hidden" name="id" value="{{ $id }}">
{{ csrfGenerate .Context.User.ID }}
{{ ieForm .Gin }}
</form>
{{ if ne $id "new" }}
<form action="/dev/apps/delete" method="POST" id="delete-form">
{{ csrfGenerate $.Context.User.ID }}
<input type="hidden" name="id" value="{{ $id }}">
{{ ieForm $.Gin }}
</form>
{{ end }}
<div class="ui divider"></div>
<div style="text-align: right">
<button type="submit" class="ui blue button" form="edit-form">Save</button>
{{ if ne $id "new" }}
<button type="submit" class="ui red button" form="delete-form">Delete</button>
{{ end }}
</div>
{{ else }}
That application could not be found!
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}

View File

@@ -0,0 +1,55 @@
{{/*###
Handler=/dev/tokens/edit
TitleBar=Edit API token
KyutGrill=dev.jpg
MinPrivileges=2
Include=menu.html
HugeHeadingRight=true
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "devSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
{{ with .Get "tokens?id=%d" (.Gin.Query "id" | atoint) }}
{{ if .tokens }}
{{ with index .tokens 0 }}
<form class="ui form" method="POST" action="/dev/tokens/edit" id="edit-form">
<div class="field">
<label>Last used</label>
<input type="text" value="{{ .last_updated }}" disabled>
</div>
<div class="field">
<label>Privileges</label>
<input name="privileges" type="number" min="0" value="{{ printf "%.0f" .privileges }}">
</div>
<div class="field">
<label>Description</label>
<input name="description" type="text" value="{{ .description }}">
</div>
<input type="hidden" name="id" value="{{ $.Gin.Query "id" | atoint }}">
{{ csrfGenerate $.Context.User.ID }}
{{ ieForm $.Gin }}
</form>
<form action="/dev/tokens/delete" method="POST" id="delete-form">
{{ csrfGenerate $.Context.User.ID }}
<input type="hidden" name="id" value="{{ $.Gin.Query "id" | atoint }}">
{{ ieForm $.Gin }}
</form>
<div class="ui divider"></div>
<div style="text-align: right">
<button type="submit" class="ui blue button" form="edit-form">Save</button>
<button type="submit" class="ui red button" form="delete-form">Delete</button>
</div>
{{ end }}
{{ else }}
That token could not be found!
{{ end }}
{{ end }}
</div>
</div>
</div>
</div>
{{ end }}

12
templates/dev/menu.html Normal file
View File

@@ -0,0 +1,12 @@
{{/*###
NoCompile=true
*/}}
{{ define "devSidebar" }}
<div class="four wide column">
<div class="ui fluid vertical menu">
{{ navbarItem .Path "Tokens" "/dev/tokens" }}
{{ navbarItem .Path "My Applications" "/dev/apps" }}
{{ navbarItem .Path "Documentation" "https://docs.ripple.moe" }}
</div>
</div>
{{ end }}

103
templates/dev/tokens.html Normal file
View File

@@ -0,0 +1,103 @@
{{/*###
Handler=/dev/tokens
TitleBar=Your API tokens
KyutGrill=dev.jpg
MinPrivileges=2
Include=menu.html
HugeHeadingRight=true
*/}}
{{ define "tpl" }}
{{ $ := . }}
<div class="ui container">
<div class="ui stackable grid">
{{ template "devSidebar" . }}
<div class="twelve wide column">
<div class="ui segment">
From this page you can create, modify and delete your personal <a href="https://docs.ripple.moe/docs/api/appendix#authorization">API tokens</a>.<br>
{{ .T "The Ripple API is the system through which developers can create applications to interact with Ripple. <b>If you're asked to fill out an API token from this page, be wary and only actually create the token if you really trust the owner of the application.</b>" | html }}
<div class="ui divider"></div>
{{ $csrf := csrfGenerate .Context.User.ID }}
{{ $page := or (atoint (.Gin.Query "p")) 1 }}
{{ with .Get "tokens?p=%d&l=50" $page }}
{{ with .tokens }}
<table class="ui fixed table">
<thead>
<tr>
<th>Privileges</th>
<th>Description</th>
<th>Last used</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{{ range . }}
<tr>
{{/* We are using printf with %.0f so that
it gets printed as if it was a normal int */}}
<td><span title="{{ privilegesToString .privileges }}">{{ printf "%.0f" .privileges }}</span></td>
<td>{{ with .description }}{{ . }}{{ else }}<i>(None)</i>{{ end }}</td>
<td>{{ if ne (nativeTime .last_updated).Year 1970 }}{{ time .last_updated }}{{ else }}Never{{ end }}</td>
<td>
<form action="/dev/tokens/delete" method="POST">
<input type="hidden" name="id" value="{{ .id }}">
{{ $csrf }}
{{ ieForm $.Gin }}
<div class="ui buttons">
<a class="ui blue icon button" href="/dev/tokens/edit?id={{ .id }}" title="Edit">
<i class="edit icon"></i>
</a>
<button class="ui red icon button" type="submit" title="Delete">
<i class="remove icon"></i>
</button>
</div>
</form>
</td>
</tr>
{{ end }}
</tbody>
{{ $left := gt $page 1 }}
{{ $right := eq (len .) 50 }}
{{ if or $left $right }}
<tfoot>
<tr>
<th colspan="4">
<div class="ui right floated pagination menu">
{{ if $left }}
<a class="icon item" href="/dev/tokens?p={{ minus (float $page) 1 }}">
<i class="left chevron icon"></i>
</a>
{{ end }}
{{ if $right }}
<a class="icon item" href="/dev/tokens?p={{ plus (float $page) 1 }}">
<i class="right chevron icon"></i>
</a>
{{ end }}
</div>
</th>
</tr>
</tfoot>
{{ end }}
</table>
<div class="ui divider"></div>
{{ end }}
{{ end }}
<h2 class="ui header" style="margin-top:0">Create new token</h2>
<form action="/dev/tokens/create" method="POST" class="ui form">
<div class="field">
<label>Privileges</label>
<input type="number" name="privileges" value="0" id="privileges-number" min="0">
<div id="privileges-text"></div>
</div>
<div class="field">
<label>Description</label>
<input type="text" name="description" value="" placeholder="For what are you making this token?">
</div>
<button class="ui blue button" type="submit">Create</button>
{{ $csrf }}
{{ ieForm $.Gin }}
</form>
</div>
</div>
</div>
</div>
{{ end }}