Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
number571 committed Jan 27, 2025
1 parent 6d226dc commit e3c683b
Show file tree
Hide file tree
Showing 7 changed files with 320 additions and 306 deletions.
5 changes: 3 additions & 2 deletions internal/applications/filesharer/internal/handler/friends.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (

type sFriends struct {
*sTemplate
FFriends []string
FFriendBaseURL string
FFriends []string
FFriendBaseURL string
FUsedBaseURLBlock string
}

func FriendsPage(
Expand Down
5 changes: 3 additions & 2 deletions internal/applications/messenger/internal/handler/friends.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (

type sFriends struct {
*sTemplate
FFriends []string
FFriendBaseURL string
FFriends []string
FFriendBaseURL string
FUsedBaseURLBlock string
}

func FriendsPage(
Expand Down
6 changes: 4 additions & 2 deletions internal/applications/notifier/internal/handler/friends.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ import (

type sFriends struct {
*sTemplate
FFriends []string
FFriendBaseURL string
FFriends []string
FFriendBaseURL string
FUsedBaseURLBlock string
}

func FriendsPage(
Expand Down Expand Up @@ -89,6 +90,7 @@ func FriendsPage(
result.sTemplate = getTemplate(pCfg)
result.FFriends = make([]string, 0, len(friends))
result.FFriendBaseURL = "/friends/chat"
result.FUsedBaseURLBlock = "Anonymous chat"

friendsList := make([]string, 0, len(friends))
for aliasName := range friends {
Expand Down
12 changes: 11 additions & 1 deletion internal/webui/template/friends.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ <h5 class="card-header text-white bg-secondary p-2">
</div>
</form>
{{$friendBaseURL:=.FFriendBaseURL}}
{{$usedBaseURLBlock:=.FUsedBaseURLBlock}}
{{if $usedBaseURLBlock}}
<div class="mb-3">
<div class="row">
<div class="col-md-12">
<a href="{{$friendBaseURL}}" class="ellipsis btn btn-secondary button w-100">{{$usedBaseURLBlock}}</a>
</div>
</div>
</div>
{{end}}
{{range .FFriends}}
<form class="mb-3" method="POST" action="/friends">
<!-- HTML does not support another methods (PUT, DELETE, etc...) -->
Expand All @@ -77,7 +87,7 @@ <h5 class="card-header text-white bg-secondary p-2">
<input hidden type="text" name="alias_name" value="{{.}}"
class="text-center form-control w-100">
<!-- GET -->
<a href="{{$friendBaseURL}}?alias_name={{.}}" class="ellipsis btn btn-secondary button w-100">{{.}}</a>
<a href="{{$friendBaseURL}}?alias_name={{.}}" class="{{if $usedBaseURLBlock}}disabled{{end}} ellipsis btn btn-secondary button w-100">{{.}}</a>
</div>
<div class="col-md-4 w-25">
<input type="submit" name="submit" value="" class="btn btn-info w-100">
Expand Down
4 changes: 2 additions & 2 deletions internal/webui/template/notifier/chat.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
let obj = JSON.parse(e.data);

var d1 = document.getElementById('chat_body');
var aliasName = "(hidden-friend)";
var aliasName = "__hidden__";
var insertHTML = "";
if (obj.filename == "") { // got text message
insertHTML = `
Expand Down Expand Up @@ -130,7 +130,7 @@
<div class="need-break-text d-flex flex-row justify-content-start mb-2 pt-1">
<div>
<p class="border border-secondary rounded text-center p-2 me-3 mb-1 text-white bg-dark">
(hidden-friend)
__hidden__
</p>
{{if (eq .FFileName "")}}
<p class="rounded text-center p-2 ms-3 mb-1 text-white bg-secondary">{{.FTextData}}</p>
Expand Down
2 changes: 1 addition & 1 deletion test/result/badge_codelines.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit e3c683b

Please sign in to comment.