Use <base> element to set target

master
r 3 years ago
parent dd23ac4867
commit e9f5e0cab5

@ -25,6 +25,7 @@ type CommonData struct {
CustomCSS string
CSRFToken string
AutoRefresh bool
Target string
}
type ErrorData struct {

@ -189,6 +189,7 @@ func (svc *service) ServeNavPage(ctx context.Context, c *model.Client) (err erro
}
commonData := svc.getCommonData(ctx, c, "Nav")
commonData.Target = "main"
data := &renderer.NavData{
User: u,
CommonData: commonData,
@ -422,6 +423,7 @@ func (svc *service) ServeNotificationPage(ctx context.Context, c *model.Client,
commonData := svc.getCommonData(ctx, c, "notifications")
commonData.AutoRefresh = c.Session.Settings.AutoRefreshNotifications
commonData.Target = "main"
data := &renderer.NotificationData{
Notifications: notifications,
UnreadCount: unreadCount,

@ -4,6 +4,9 @@
<head>
<meta charset='utf-8'>
<meta content='width=device-width, initial-scale=1' name='viewport'>
{{if .Target}}
<base href="" target="{{.Target}}">
{{end}}
{{if .CSRFToken}}
<meta name="csrf_token" content="{{.CSRFToken}}">
{{end}}

@ -2,24 +2,24 @@
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
<div class="user-info">
<div class="user-info-img-container">
<a class="img-link" href="/timeline/home" title="home" target="main">
<a class="img-link" href="/timeline/home" title="home">
<img class="user-info-img" src="{{.User.AvatarStatic}}" alt="profile-avatar" />
</a>
</div>
<div class="user-info-details-container">
<div>
<span class="status-dname"> {{EmojiFilter .User.DisplayName .User.Emojis}} </span>
<a class="nav-link" href="/user/{{.User.ID}}" target="main">
<a class="nav-link" href="/user/{{.User.ID}}">
<span class="status-uname"> {{.User.Acct}} </span>
</a>
</div>
<div>
<a class="nav-link" href="/timeline/home" target="main">home</a>
<a class="nav-link" href="/timeline/direct" target="main">direct</a>
<a class="nav-link" href="/timeline/local" target="main">local</a>
<a class="nav-link" href="/timeline/twkn" target="main">twkn</a>
<a class="nav-link" href="/search" target="main">search</a>
<a class="nav-link" href="/about" target="main">about</a>
<a class="nav-link" href="/timeline/home">home</a>
<a class="nav-link" href="/timeline/direct">direct</a>
<a class="nav-link" href="/timeline/local">local</a>
<a class="nav-link" href="/timeline/twkn">twkn</a>
<a class="nav-link" href="/search">search</a>
<a class="nav-link" href="/about">about</a>
</div>
<div>
<a class="nav-link" href="/settings" target="_top">settings</a>

@ -5,9 +5,9 @@
Notifications
{{if gt .UnreadCount 0}}({{.UnreadCount }}){{end}}
</div>
<a class="notification-refresh" href="/notifications">refresh</a>
<a class="notification-refresh" href="/notifications" target="_self">refresh</a>
{{if .ReadID}}
<form action="/notifications/read?max_id={{.ReadID}}" method="post">
<form action="/notifications/read?max_id={{.ReadID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="read" class="btn-link">
</form>
@ -19,7 +19,7 @@
{{if eq .Type "follow"}}
<div class="notification-follow-container">
<div class="status-profile-img-container">
<a class="img-link" href="/user/{{.Account.ID}}" target="main" >
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="profile-avatar" />
</a>
</div>
@ -42,7 +42,7 @@
{{else if eq .Type "reblog"}}
<div class="retweet-info">
<a class="img-link" href="/user/{{.Account.ID}}" target="main">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@ -55,7 +55,7 @@
{{else if eq .Type "favourite"}}
<div class="retweet-info">
<a class="img-link" href="/user/{{.Account.ID}}" target="main">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@ -71,7 +71,7 @@
<div class="pagination">
{{if .NextLink}}
<a href="{{.NextLink}}">next</a>
<a href="{{.NextLink}}" target="_self">next</a>
{{end}}
</div>

@ -1,5 +1,5 @@
{{with .Data}}
<form class="post-form" action="/post" method="POST" enctype="multipart/form-data">
<form class="post-form" action="/post" method="POST" enctype="multipart/form-data" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
{{if .ReplyContext}}
<input type="hidden" name="reply_to_id" value="{{.ReplyContext.InReplyToID}}" />

@ -2,7 +2,7 @@
<div id="status-{{.ID}}" class="status-container-container">
{{if .Reblog}}
<div class="retweet-info">
<a class="img-link" href="/user/{{.Account.ID}}" target="main">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
@ -14,14 +14,14 @@
{{with $s := .Data}}
<div class="status-container status-{{.ID}}" data-id="{{.ID}}">
<div class="status-profile-img-container">
<a class="img-link" href="/user/{{.Account.ID}}" target="main">
<a class="img-link" href="/user/{{.Account.ID}}">
<img class="status-profile-img" src="{{.Account.AvatarStatic}}" alt="avatar" />
</a>
</div>
<div class="status">
<div class="status-name">
<span class="status-dname"> {{EmojiFilter .Account.DisplayName .Account.Emojis}} </span>
<a href="/user/{{.Account.ID}}" target="main">
<a href="/user/{{.Account.ID}}">
<span class="status-uname"> {{.Account.Acct}} </span>
</a>
<div class="more-container">
@ -33,18 +33,18 @@
source
</a>
{{if .Muted}}
<form action="/unmuteconv/{{.ID}}" method="post">
<form action="/unmuteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="unmute" class="btn-link more-link">
</form>
{{else}}
<form action="/muteconv/{{.ID}}" method="post">
<form action="/muteconv/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="mute" class="btn-link more-link">
</form>
{{end}}
{{if eq $.Ctx.UserID .Account.ID}}
<form action="/delete/{{.ID}}" method="post">
<form action="/delete/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="submit" value="delete" class="btn-link more-link">
</form>
@ -55,7 +55,7 @@
<div class="status-reply-container">
{{if .InReplyToID}}
<div class="status-reply-to">
<a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}" target="main">
<a class="status-reply-to-link" href="{{if not .ShowReplies}}/thread/{{.InReplyToID}}{{end}}#status-{{.InReplyToID}}">
reply to {{.Pleroma.InReplyToAccountAcct}}
</a>
</div>
@ -103,7 +103,7 @@
{{end}}
</div>
{{if .Poll}}
<form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST">
<form class="poll-form" action="/vote/{{.Poll.ID}}" method="POST" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="status_id" value="{{$s.ID}}">
{{range $i, $o := .Poll.Options}}
@ -139,58 +139,58 @@
{{end}}
<div class="status-action-container">
<div class="status-action">
<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}" target="main">
<a href="/thread/{{.ID}}?reply=true#status-{{.ID}}">
reply
</a>
<a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" target="{{if $.Ctx.ThreadInNewTab}}_blank{{else}}main{{end}}">
<a class="status-reply-count" href="/thread/{{.ID}}#status-{{.ID}}" {{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
{{if .RepliesCount}} ({{DisplayInteractionCount .RepliesCount}}) {{end}}
</a>
</div>
<div class="status-action">
{{if or (eq .Visibility "private") (eq .Visibility "direct")}}
<a class="status-retweet" href="" title="this status cannot be retweeted" target="main">
<a class="status-retweet" href="" title="this status cannot be retweeted">
retweet
</a>
{{else}}
{{if .Reblogged}}
<form class="status-retweet" data-action="unretweet" action="/unretweet/{{.ID}}" method="post">
<form class="status-retweet" data-action="unretweet" action="/unretweet/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unretweet" class="btn-link">
</form>
{{else}}
<form class="status-retweet" data-action="retweet" action="/retweet/{{.ID}}" method="post">
<form class="status-retweet" data-action="retweet" action="/retweet/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="retweet" class="btn-link">
</form>
{{end}}
{{end}}
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list" target="main">
<a class="status-retweet-count" href="/retweetedby/{{.ID}}" title="click to see the the list">
{{if .ReblogsCount}} ({{DisplayInteractionCount .ReblogsCount}}) {{end}}
</a>
</div>
<div class="status-action">
{{if .Favourited}}
<form class="status-like" data-action="unlike" action="/unlike/{{.ID}}" method="post">
<form class="status-like" data-action="unlike" action="/unlike/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="unlike" class="btn-link">
</form>
{{else}}
<form class="status-like" data-action="like" action="/like/{{.ID}}" method="post">
<form class="status-like" data-action="like" action="/like/{{.ID}}" method="post" target="_self">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="retweeted_by_id" value="{{.RetweetedByID}}">
<input type="submit" value="like" class="btn-link">
</form>
{{end}}
<a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list" target="main">
<a class="status-like-count" href="/likedby/{{.ID}}" title="click to see the the list">
{{if .FavouritesCount}} ({{DisplayInteractionCount .FavouritesCount}}) {{end}}
</a>
</div>
<div class="status-action">
<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
target="{{if $.Ctx.ThreadInNewTab}}_blank{{else}}main{{end}}">
<a class="status-time" href="{{if not .ShowReplies}}/thread/{{.ID}}{{end}}#status-{{.ID}}"
{{if $.Ctx.ThreadInNewTab}}target="_blank"{{end}}>
<time datetime="{{FormatTimeRFC3339 .CreatedAt}}" title="{{FormatTimeRFC822 .CreatedAt}}">
{{TimeSince .CreatedAt}}
</time>

Loading…
Cancel
Save