add support for niconico videos
tweak tempra simple text attach padding
This commit is contained in:
parent
cb383240f8
commit
019efc8c62
|
@ -1078,6 +1078,13 @@ func parseMediaString(data string, settings *ParseSettings) (media MediaEmbed, o
|
||||||
media.Body = "<iframe class='postIframe'src='https://www.youtube-nocookie.com/embed/" + video[0] + "'frameborder=0 allowfullscreen></iframe>"
|
media.Body = "<iframe class='postIframe'src='https://www.youtube-nocookie.com/embed/" + video[0] + "'frameborder=0 allowfullscreen></iframe>"
|
||||||
return media, true
|
return media, true
|
||||||
}
|
}
|
||||||
|
} else if strings.HasPrefix(host, "www.nicovideo.jp") && strings.HasPrefix(path, "/watch/sm") {
|
||||||
|
vid, err := strconv.ParseInt(strings.TrimPrefix(path, "/watch/sm"), 10, 64)
|
||||||
|
if err == nil {
|
||||||
|
media.Type = ERaw
|
||||||
|
media.Body = "<iframe class='postIframe'src='https://embed.nicovideo.jp/watch/sm"+strconv.FormatInt(vid, 10)+"?jsapi=1&playerId=1'frameborder=0 allowfullscreen></iframe>"
|
||||||
|
return media, true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if lastFrag := pathFrags[len(pathFrags)-1]; lastFrag != "" {
|
if lastFrag := pathFrags[len(pathFrags)-1]; lastFrag != "" {
|
||||||
|
|
|
@ -134,11 +134,12 @@ func renderTemplate2(tmplName, hookName string, w http.ResponseWriter, r *http.R
|
||||||
}
|
}
|
||||||
|
|
||||||
func FootHeaders(w http.ResponseWriter, h *c.Header) {
|
func FootHeaders(w http.ResponseWriter, h *c.Header) {
|
||||||
|
// TODO: Only set video domain when there is a video on the page
|
||||||
if !h.LooseCSP {
|
if !h.LooseCSP {
|
||||||
if c.Config.SslSchema {
|
if c.Config.SslSchema {
|
||||||
w.Header().Set("Content-Security-Policy", "default-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src * data: 'unsafe-eval' 'unsafe-inline'; connect-src * 'unsafe-eval' 'unsafe-inline'; frame-src 'self' www.youtube-nocookie.com;upgrade-insecure-requests")
|
w.Header().Set("Content-Security-Policy", "default-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src * data: 'unsafe-eval' 'unsafe-inline'; connect-src * 'unsafe-eval' 'unsafe-inline'; frame-src 'self' www.youtube-nocookie.com embed.nicovideo.jp;upgrade-insecure-requests")
|
||||||
} else {
|
} else {
|
||||||
w.Header().Set("Content-Security-Policy", "default-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src * data: 'unsafe-eval' 'unsafe-inline'; connect-src * 'unsafe-eval' 'unsafe-inline'; frame-src 'self' www.youtube-nocookie.com")
|
w.Header().Set("Content-Security-Policy", "default-src 'self' 'unsafe-eval'; style-src 'self' 'unsafe-eval' 'unsafe-inline'; img-src * data: 'unsafe-eval' 'unsafe-inline'; connect-src * 'unsafe-eval' 'unsafe-inline'; frame-src 'self' www.youtube-nocookie.com embed.nicovideo.jp")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -826,16 +826,10 @@ red {
|
||||||
.staff_post .hide_spoil img {
|
.staff_post .hide_spoil img {
|
||||||
background-color: rgb(240,180,240);
|
background-color: rgb(240,180,240);
|
||||||
}
|
}
|
||||||
.attach_box {
|
|
||||||
background-color: #5a5555;
|
|
||||||
background-color: rgb(71,71,76);
|
|
||||||
border-radius: 3px;
|
|
||||||
padding: 16px;
|
|
||||||
}
|
|
||||||
.attach_box {
|
.attach_box {
|
||||||
border: 1px solid hsl(10, 0%, 80%);
|
border: 1px solid hsl(10, 0%, 80%);
|
||||||
background: white;
|
background: white;
|
||||||
padding: 5px;
|
padding: 12px;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
Loading…
Reference in New Issue