dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

chat-archive.gohtml (8800B)


      1 {{ define "extra-head" }}
      2 <style>
      3     html, body {
      4         background-color: {{ .AuthUser.ChatBackgroundColor }} !important;
      5     }
      6     .mod-btn {
      7         width: 16px; height: 16px;
      8         margin: 0; padding: 0;
      9         border: 1px solid gray;
     10         display: inline;
     11         text-align: center;
     12         vertical-align: middle;
     13         user-select: none;
     14         background-color: #444;
     15         color: #ea2a2a;
     16         -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.25);
     17         -moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.25);
     18         -webkit-border-radius: 3px;
     19         -moz-border-radius: 3px;
     20     }
     21     .mod-btn:hover {
     22         background-color: #222;
     23     }
     24     .delete_msg_btn {
     25         font-size: 15px;
     26         line-height: 1;
     27     }
     28     .delete_msg_btn::after { content: "×"; }
     29     .hb_btn {
     30         font-size: 10px;
     31         line-height: 1.4;
     32     }
     33     .hb_btn::after { content: "hb"; }
     34     .k_btn {
     35         font-size: 10px;
     36         line-height: 1.4;
     37     }
     38     .k_btn::after { content: "k"; }
     39 
     40     :target {
     41         -webkit-animation: target-fade 3s 1;
     42         -moz-animation: target-fade 3s 1;
     43     }
     44 
     45     @-webkit-keyframes target-fade {
     46         0% { background-color: rgba(255,213,0,0.5); }
     47         100% { background-color: rgba(0,0,0,0); }
     48     }
     49 
     50     @-moz-keyframes target-fade {
     51         0% { background-color: rgba(255,213,0,0.5); }
     52         100% { background-color: rgba(0,0,0,0); }
     53     }
     54     .sysmsg { color: #fff; font-family: 'Courier New', Courier, monospace; font-size: 14px; }
     55     small { font-size: 80%; font-weight: 400; }
     56     .msg p:first-of-type { display: inline; }
     57     strong { font-weight: bold; }
     58     em { font-style: italic; }
     59     ul { list-style-type: disc; margin: 0 0 0 15px; padding: 0; margin-bottom: 0 !important; }
     60     pre { border: 1px solid #2b442b; padding: 2px; margin: 2px 0; max-height: {{ .AuthUser.CodeBlockHeight }}px; overflow: auto; background-color: rgba(39,40,34,0.6) !important; }
     61     .fullscreen { position: absolute; margin-top: -37px; right: 3px; }
     62     code {  border: 1px solid #2b442b; color: #f92672; padding: 0 2px; margin: 0px 0; background-color: rgba(39,40,34,0.6) !important; }
     63     .o-wrap { overflow-wrap: break-word; }
     64 </style>
     65 {{ end }}
     66 
     67 {{ define "title" }}dkf - #{{ .Data.Room.Name }} archive{{ end }}
     68 
     69 {{ define "content" }}
     70 
     71 <div class="container-fluid">
     72 
     73     <nav aria-label="breadcrumb">
     74         <ol class="breadcrumb">
     75             <li class="breadcrumb-item"><a href="/chat/{{ .Data.Room.Name }}">{{ .Data.Room.Name }}</a></li>
     76             <li class="breadcrumb-item active">{{ t "Archive" . }}</li>
     77         </ol>
     78     </nav>
     79 
     80     <div class="mb-3">
     81         {{ range .Data.Messages }}
     82             {{ if (.UserCanSee $.AuthUser) }}
     83                 <div class="msg" style="border-bottom: 1px solid #444; color: #888; position: relative;{{ if and (or .User.IsHellbanned .IsHellbanned) $.AuthUser.DisplayHellbanned }} background-color: rgba(0, 0, 0, 0.7); opacity: {{ $.AuthUser.GetHellbanOpacityF64 }};{{ end }}" id="{{ .UUID }}">
     84                     {{ if (.UserCanDelete $.AuthUser) }}
     85                         {{ if not .TooOldToDelete }}
     86                             <form method="post" action="/api/v1/chat/messages/delete/{{ .UUID }}" style="display: inline;">
     87                                 <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     88                                 <button class="mod-btn delete_msg_btn" title="delete"></button>
     89                             </form>
     90                         {{ else if or (and $.AuthUser.IsModerator .TooOldToDelete (ne .UserID $.AuthUser.ID)) $.AuthUser.IsAdmin (and .Room.OwnerUserID (eq (derefUserID .Room.OwnerUserID) $.AuthUser.ID)) }}
     91                             <form method="post" action="/api/v1/chat/messages/delete/{{ .UUID }}" style="display: inline;">
     92                                 <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     93                                 <button class="mod-btn delete_msg_btn" style="color: orange;" title="delete"></button>
     94                             </form>
     95                         {{ else if $.AuthUser.IsModerator }}
     96                             <div style="display: inline-block; width: 16px;"></div>
     97                         {{ else }}
     98                             <div style="display: inline-block; width: 16px;"></div>
     99                         {{ end }}
    100                         {{ if $.AuthUser.IsModerator }}
    101                             {{ if ne .UserID $.AuthUser.ID }}
    102                                 {{- if .User.IsHellbanned -}}
    103                                     <form method="post" action="/api/v1/users/{{ .UserID }}/unhellban" style="display: inline;">
    104                                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
    105                                         <button class="mod-btn hb_btn" style="color: orange; text-decoration: line-through;" title="unhellban"></button>
    106                                     </form>
    107                                 {{- else -}}
    108                                     <form method="post" action="/api/v1/users/{{ .UserID }}/hellban" style="display: inline;">
    109                                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
    110                                         <button class="mod-btn hb_btn" style="color: orange;" title="hellban"></button>
    111                                     </form>
    112                                 {{- end -}}
    113                                 <form method="post" action="/api/v1/users/{{ .UserID }}/kick" style="display: inline;">
    114                                     <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
    115                                     <button class="mod-btn k_btn" style="color: orange;" title="kick"></button>
    116                                 </form>
    117                             {{ else }}
    118                                 <div style="display: inline-block; width: 36px;"></div>
    119                             {{ end }}
    120                         {{ end }}
    121                     {{ else }}
    122                         {{ if and $.AuthUser.IsModerator }}
    123                             <div style="display: inline-block; width: 56px;"></div>
    124                         {{ else }}
    125                             <div style="display: inline-block; width: 16px;"></div>
    126                         {{ end }}
    127                     {{ end }}
    128                     {{- if ne $.Data.DateFormat "" -}}
    129                         <a style="color: #999; font-family: 'Courier New', Courier, monospace; font-size: 14px;" href="?uuid={{ .UUID }}#{{ .UUID }}" title="{{ .CreatedAt.Format "01-02 15:04:05" }}">{{ .CreatedAt.Format $.Data.DateFormat }}</a>&nbsp;
    130                     {{- end -}}
    131                     {{- if and $.AuthUser.CanSeeHB (or .IsHellbanned .User.IsHellbanned) (not .ToUserID) -}}
    132                         -&nbsp;
    133                     {{- else if and .ToUserID (ne .ToUser.ID $.AuthUser.ID) -}}
    134                         <a href="/u/{{ .ToUser.Username }}" target="_blank" style="color: #888;">-</a>&nbsp;
    135                     {{- else -}}
    136                         <a href="/u/{{ .User.Username }}" target="_blank" style="color: #888;">-</a>&nbsp;
    137                     {{- end -}}
    138                     {{- if .System -}}
    139                         <span class="sysmsg">{{ .Message | safe }}</span>
    140                     {{- else -}}
    141                         {{- if .Moderators -}}<span class="sysmsg">[M]</span>&nbsp;{{- end -}}
    142                         {{- if .ToUserID -}}[{{- end -}}
    143                         <a {{ .User.GenerateChatStyle | attr }} href="/u/{{ .User.Username }}" rel="noopener noreferrer" target="_blank">{{ .User.Username }}</a>
    144                         {{- if .ToUserID -}}
    145                             &nbsp;→ <a {{ .ToUser.GenerateChatStyle | attr }} href="/u/{{ .ToUser.Username }}" rel="noopener noreferrer" target="_blank">{{ .ToUser.Username }}</a>] -
    146                         {{- else -}}
    147                             {{- if not .IsMe -}}
    148                                 &nbsp;-
    149                             {{- end -}}
    150                         {{- end -}}
    151                         &nbsp;<span {{ .User.GenerateChatStyle | attr }}><span class="o-wrap">{{ .MsgToDisplay $.AuthUser | safe }}</span></span>
    152                     {{- end -}}
    153                 </div>
    154             {{- end -}}
    155         {{ else }}
    156             <div><em>No message yet</em></div>
    157         {{ end }}
    158     </div>
    159 
    160     {{ if not .Data.UUID }}
    161         <div class="mb-5">
    162             <a href="?p={{ add .Data.CurrentPage -1 }}" class="btn btn-light{{ if le .Data.CurrentPage 1 }} disabled{{ end }}">&laquo; {{ t "Prev" . }}</a>
    163             <a href="?p={{ add .Data.CurrentPage 1 }}" class="btn btn-light{{ if eq .Data.CurrentPage .Data.MaxPage }} disabled{{ end }}">{{ t "Next" . }} &raquo;</a>
    164         </div>
    165     {{ end }}
    166 </div>
    167 
    168 {{ end }}