mirror of
https://github.com/derf/travelynx
synced 2024-12-04 18:29:11 +00:00
52c0da3f46
This is a breaking change insofar as that traewelling support is no longer provided automatically, but must be enabled by providing a traewelling.de application ID and secret in travelynx.conf. However, as traewelling.de password login is deprecated and wil soon be disabled, travelynx would break either way. So we might or might not see travelynx 2.0.0 in the next days. Automatic token refresh is still todo, but that was the case for password login as well. Closes #64
421 lines
12 KiB
Text
421 lines
12 KiB
Text
% if (my $invalid = flash('invalid')) {
|
||
%= include '_invalid_input', invalid => $invalid
|
||
% }
|
||
|
||
% if (my $success = flash('success')) {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<div class="card success-color">
|
||
<div class="card-content white-text">
|
||
% if ($success eq 'name') {
|
||
<span class="card-title">Name geändert</span>
|
||
% }
|
||
% elsif ($success eq 'mail') {
|
||
<span class="card-title">Mail-Adresse geändert</span>
|
||
% }
|
||
% elsif ($success eq 'password') {
|
||
<span class="card-title">Passwort geändert</span>
|
||
% }
|
||
% elsif ($success eq 'privacy') {
|
||
<span class="card-title">Einstellungen zu öffentlichen Account-Daten geändert</span>
|
||
% }
|
||
% elsif ($success eq 'social') {
|
||
<span class="card-title">Einstellungen zur Interaktionen mit anderen Accounts geändert</span>
|
||
% }
|
||
% elsif ($success eq 'traewelling') {
|
||
<span class="card-title">Träwelling-Verknüpfung aktualisiert</span>
|
||
% }
|
||
% elsif ($success eq 'use_history') {
|
||
<span class="card-title">Einstellungen zu vorgeschlagenen Verbindungen geändert</span>
|
||
% }
|
||
% elsif ($success eq 'external') {
|
||
<span class="card-title">Einstellungen zu externen Diensten geändert</span>
|
||
% }
|
||
% elsif ($success eq 'webhook') {
|
||
<span class="card-title">Web Hook aktualisiert</span>
|
||
% }
|
||
% elsif ($success eq 'clear_notifications') {
|
||
<span class="card-title">Benachrichtigungen gelesen</span>
|
||
% }
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
% }
|
||
|
||
% my $acc = current_user();
|
||
% my $hook = users->get_webhook(uid => $acc->{id});
|
||
% my $traewelling = traewelling->get(uid => $acc->{id});
|
||
% my $use_history = users->use_history(uid => $acc->{id});
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h2>Account</h2>
|
||
<table class="striped">
|
||
<tr>
|
||
<th scope="row">Name</th>
|
||
<td><a href="/account/name"><i class="material-icons">edit</i></a><%= $acc->{name} %></td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Mail</th>
|
||
<td><a href="/account/mail"><i class="material-icons">edit</i></a><%= $acc->{email} %></td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Passwort</th>
|
||
<td><a href="/account/password"><i class="material-icons">edit</i></a></td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Verbindungen</th>
|
||
<td>
|
||
<a href="/account/insight"><i class="material-icons">edit</i></a>
|
||
% if ($use_history & 0x07) {
|
||
Vorschläge aktiv
|
||
% }
|
||
% else {
|
||
<span style="color: #999999;">Vorschläge deaktiviert</span>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Sichtbarkeit</th>
|
||
<td>
|
||
<a href="/account/privacy"><i class="material-icons">edit</i></a>
|
||
<i class="material-icons">check</i><i class="material-icons"><%= visibility_icon($acc->{default_visibility_str}) %></i>
|
||
• <i class="material-icons">history</i><i class="material-icons"><%= visibility_icon($acc->{past_visibility_str}) %></i>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Interaktion</th>
|
||
<td>
|
||
<a href="/account/social"><i class="material-icons">edit</i></a>
|
||
% if ($acc->{accept_follows}) {
|
||
<span>Accounts können dir direkt folgen</span>
|
||
% }
|
||
% elsif ($acc->{accept_follow_requests}) {
|
||
<span>Accounts können dir auf Anfrage folgen
|
||
% if ($num_rx_follow_requests == 1) {
|
||
– <a href="/account/social/follow-requests-received"><strong>eine</strong> offene Anfrage</a>
|
||
% } elsif ($num_rx_follow_requests) {
|
||
– <a href="/account/social/follow-requests-received"><strong><%= $num_rx_follow_requests %></strong> offene Anfragen</a>
|
||
% }
|
||
</span>
|
||
% }
|
||
% else {
|
||
<span style="color: #999999;">Accounts können dir nicht folgen</span>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Web Hook</th>
|
||
<td>
|
||
<a href="/account/hooks"><i class="material-icons">edit</i></a>
|
||
% if (not $hook->{enabled}) {
|
||
<span style="color: #999999;">Nicht eingerichtet</span>
|
||
% }
|
||
% elsif ($hook->{latest_run}->epoch == 0) {
|
||
Aktiv, noch nicht ausgeführt
|
||
% }
|
||
% elsif ($hook->{errored}) {
|
||
Aktiv, fehlerhaft <i class="material-icons" aria-hidden="true">error</i>
|
||
% }
|
||
% else {
|
||
Aktiv
|
||
% }
|
||
</td>
|
||
</tr>
|
||
% if (config->{traewelling}{oauth}) {
|
||
<tr>
|
||
<th scope="row">Träwelling</th>
|
||
<td>
|
||
<a href="/account/traewelling"><i class="material-icons">edit</i></a>
|
||
% if (not ($traewelling->{token})) {
|
||
<span style="color: #999999;">Nicht verknüpft</span>
|
||
% }
|
||
% elsif ($traewelling->{errored}) {
|
||
Fehlerhaft <i class="material-icons" aria-hidden="true">error</i>
|
||
% }
|
||
% else {
|
||
Verknüpft mit <%= $traewelling->{data}{user_name} // $traewelling->{email} %>
|
||
% if ($traewelling->{expired}) {
|
||
– Login-Token abgelaufen <i class="material-icons" aria-hidden="true">error</i>
|
||
% }
|
||
% elsif ($traewelling->{expiring}) {
|
||
– Login-Token läuft bald ab <i class="material-icons" aria-hidden="true">warning</i>
|
||
% }
|
||
% elsif ($traewelling->{pull_sync}) {
|
||
– Checkins in Träwelling werden von travelynx übernommen
|
||
% }
|
||
% elsif ($traewelling->{push_sync}) {
|
||
– Checkins in travelynx werden zu Träwelling weitergereicht
|
||
% }
|
||
% }
|
||
</td>
|
||
</tr>
|
||
% }
|
||
<tr>
|
||
<th scope="row">Externe Dienste</th>
|
||
<td>
|
||
<a href="/account/services"><i class="material-icons">edit</i></a>
|
||
% if ($acc->{sb_name}) {
|
||
Abfahrtstafel: <%= $acc->{sb_name} %>
|
||
% }
|
||
% else {
|
||
<span style="color: #999999;">Keine</span>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Registriert am</th>
|
||
<td><%= $acc->{registered_at}->strftime('%d.%m.%Y %H:%M') %></td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
<div class="col s12 m12 l12 center-align">
|
||
%= form_for 'logout' => begin
|
||
%= csrf_field
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="logout">
|
||
Abmelden
|
||
</button>
|
||
%= end
|
||
</div>
|
||
</div>
|
||
|
||
% if ($num_rx_follow_requests or $num_tx_follow_requests or $num_followers or $num_following or $num_blocked) {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h2>Interaktion</h2>
|
||
<p>
|
||
<a href="/p/<%= $acc->{name} %>">Öffentliches Profil</a>
|
||
</p>
|
||
<table class="striped">
|
||
<tr>
|
||
<th scope="row">Anfragen</th>
|
||
<td>
|
||
% if ($num_rx_follow_requests == 0) {
|
||
<span style="color: #999999;">keine eingehend</span>
|
||
% }
|
||
% elsif ($num_rx_follow_requests == 1) {
|
||
<a href="/account/social/follow-requests-received"><strong>eine</strong> eingehend</a>
|
||
% }
|
||
% else {
|
||
<a href="/account/social/follow-requests-received"><strong><%= $num_rx_follow_requests %></strong> eingehend</a>
|
||
% }
|
||
<br/>
|
||
% if ($num_tx_follow_requests == 0) {
|
||
<span style="color: #999999;">keine ausgehend</span>
|
||
% }
|
||
% elsif ($num_tx_follow_requests == 1) {
|
||
<a href="/account/social/follow-requests-sent"><strong>eine</strong> ausgehend</a>
|
||
% }
|
||
% else {
|
||
<a href="/account/social/follow-requests-sent"><strong><%= $num_tx_follow_requests %></strong> ausgehend</a>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Dir folg<%= $num_followers == 1 ? 't' : 'en' %></th>
|
||
<td>
|
||
% if ($num_followers == 0) {
|
||
<span style="color: #999999;">keine Accounts</span>
|
||
% }
|
||
% elsif ($num_followers == 1) {
|
||
<a href="/account/social/followers"><strong>ein</strong> Account</a>
|
||
% }
|
||
% else {
|
||
<a href="/account/social/followers"><strong><%= $num_followers %></strong> Accounts</a>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Du folgst</th>
|
||
<td>
|
||
% if ($num_following == 0) {
|
||
<span style="color: #999999;">keinen Accounts</span>
|
||
% }
|
||
% elsif ($num_following == 1) {
|
||
<a href="/account/social/follows"><strong>einem</strong> Account</a>
|
||
% }
|
||
% else {
|
||
<a href="/account/social/follows"><strong><%= $num_following %></strong> Accounts</a>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Blockiert</th>
|
||
<td>
|
||
% if ($num_blocked == 0) {
|
||
<span style="color: #999999;">keine Accounts</span>
|
||
% }
|
||
% elsif ($num_blocked == 1) {
|
||
<a href="/account/social/blocks"><strong>ein</strong> Account</a>
|
||
% }
|
||
% else {
|
||
<a href="/account/social/blocks"><strong><%= $num_blocked %></strong> Accounts</a>
|
||
% }
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
% }
|
||
% else {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<a href="/p/<%= $acc->{name} %>">Öffentliches Profil</a>
|
||
</div>
|
||
</div>
|
||
% }
|
||
|
||
% my $token = stash('api_token') // {};
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h2>API</h2>
|
||
<p>
|
||
Die folgenden API-Token erlauben den passwortlosen automatisierten Zugriff auf
|
||
API-Endpunkte. Bitte umsichtig behandeln – sobald ein Token gesetzt
|
||
ist, können damit ohne Logindaten alle zugehörigen API-Aktionen
|
||
ausgeführt werden.
|
||
</p>
|
||
<table class="striped">
|
||
<tr>
|
||
<th scope="row">Status</th>
|
||
<td>
|
||
% if ($token->{status}) {
|
||
%= $acc->{id} . '-' . $token->{status}
|
||
% }
|
||
% else {
|
||
—
|
||
% }
|
||
</td>
|
||
<td>
|
||
%= form_for 'set_token' => begin
|
||
%= csrf_field
|
||
%= hidden_field 'token' => 'status'
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
||
Generieren
|
||
</button>
|
||
<button class="btn waves-effect waves-light caution-color" type="submit" name="action" value="delete">
|
||
Löschen
|
||
</button>
|
||
%= end
|
||
</td>
|
||
</tr><!--
|
||
<tr>
|
||
<th scope="row">History</th>
|
||
<td>
|
||
% if ($token->{history}) {
|
||
%= $acc->{id} . '-' . $token->{history}
|
||
% }
|
||
% else {
|
||
—
|
||
% }
|
||
</td>
|
||
<td>
|
||
%= form_for 'set_token' => begin
|
||
%= csrf_field
|
||
%= hidden_field 'token' => 'history'
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
||
Generieren
|
||
</button>
|
||
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
||
Löschen
|
||
</button>
|
||
%= end
|
||
</td>
|
||
</tr>-->
|
||
<tr>
|
||
<th scope="row">Travel</th>
|
||
<td>
|
||
% if ($token->{travel}) {
|
||
%= $acc->{id} . '-' . $token->{travel}
|
||
% }
|
||
% else {
|
||
—
|
||
% }
|
||
</td>
|
||
<td>
|
||
%= form_for 'set_token' => begin
|
||
%= csrf_field
|
||
%= hidden_field 'token' => 'travel'
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
||
Generieren
|
||
</button>
|
||
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
||
Löschen
|
||
</button>
|
||
%= end
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<th scope="row">Import</th>
|
||
<td>
|
||
% if ($token->{import}) {
|
||
%= $acc->{id} . '-' . $token->{import}
|
||
% }
|
||
% else {
|
||
—
|
||
% }
|
||
</td>
|
||
<td>
|
||
%= form_for 'set_token' => begin
|
||
%= csrf_field
|
||
%= hidden_field 'token' => 'import'
|
||
<button class="btn waves-effect waves-light" type="submit" name="action" value="generate">
|
||
Generieren
|
||
</button>
|
||
<button class="btn waves-effect waves-light red" type="submit" name="action" value="delete">
|
||
Löschen
|
||
</button>
|
||
%= end
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<a href="/api">Dokumentation</a>
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h2>Export</h2>
|
||
<ul>
|
||
<li><a href="/export.json">Rohdaten</a> (Kein API-Ersatz, das Format kann sich jederzeit ändern)</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
|
||
% if (not $acc->{deletion_requested}) {
|
||
<div class="row">
|
||
<div class="col s12">
|
||
<h2>Löschen</h2>
|
||
<p>
|
||
Der Löschauftrag wird vorgemerkt und erst nach drei Tagen
|
||
umgesetzt, bis dahin kann er jederzeit zurückgenommen werden. Nach
|
||
Ablauf der drei Tage wird der Account mit allen zugehörigen
|
||
Reisedaten ohne weitere Rückfragen entfernt.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="row">
|
||
%= form_for 'delete' => begin
|
||
<div class="input-field col s12 m12 l8">
|
||
<i class="material-icons prefix">lock</i>
|
||
%= password_field 'password', id => 'password', class => 'validate', required => undef, autocomplete => 'current-password'
|
||
<label for="password">Passwort</label>
|
||
</div>
|
||
<div class="input-field col s12 m12 l4 center-align">
|
||
%= csrf_field
|
||
<button class="btn waves-effect waves-light caution-color" type="submit" name="action" value="delete">
|
||
Account löschen
|
||
</button>
|
||
</div>
|
||
%= end
|
||
</div>
|
||
% }
|