mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-28 08:06:24 -07:00
Add mp4 support
This commit is contained in:
parent
d5a5fc53eb
commit
8ccd217ff0
9 changed files with 40 additions and 8500 deletions
7731
frontend/package-lock.json
generated
7731
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
let movablePostPreviews = null;
|
||||
let expandablePostrefs = true;
|
||||
|
||||
let videoTestRE = /\.(mp4)|(webm)$/;
|
||||
function deleteCheckedPosts() {
|
||||
if(confirm('Are you sure you want to delete these posts?') == true) {
|
||||
let form = $("form#main-form");
|
||||
|
@ -117,8 +117,8 @@ export function prepareThumbnails() {
|
|||
thumb.removeAttr("width").removeAttr("height");
|
||||
|
||||
var fileInfoElement = a.prevAll(".file-info:first");
|
||||
|
||||
if((thumbURL+uploadURL).indexOf(".webm") > 0) {
|
||||
|
||||
if(videoTestRE.test(thumbURL + uploadURL)) {
|
||||
// Upload is a video
|
||||
thumb.hide();
|
||||
var video = $("<video />")
|
||||
|
|
File diff suppressed because one or more lines are too long
1
html/javascript/maps/gochan.js.map
Normal file
1
html/javascript/maps/gochan.js.map
Normal file
File diff suppressed because one or more lines are too long
|
@ -126,8 +126,8 @@ type GochanConfig struct {
|
|||
RepliesOnBoardPage int `description:"Number of replies to a thread to show on the board page."`
|
||||
StickyRepliesOnBoardPage int `description:"Same as above for stickied threads."`
|
||||
BanMsg string `description:"The default public ban message."`
|
||||
EmbedWidth int `description:"The width for inline/expanded webm videos."`
|
||||
EmbedHeight int `description:"The height for inline/expanded webm videos."`
|
||||
EmbedWidth int `description:"The width for inline/expanded videos."`
|
||||
EmbedHeight int `description:"The height for inline/expanded videos."`
|
||||
ExpandButton bool `description:"If checked, adds [Embed] after a Youtube, Vimeo, etc link to toggle an inline video frame."`
|
||||
ImagesOpenNewTab bool `description:"If checked, thumbnails will open the respective image/video in a new tab instead of expanding them." `
|
||||
NewTabOnOutlinks bool `description:"If checked, links to external sites will open in a new tab."`
|
||||
|
|
|
@ -800,7 +800,7 @@ func DeleteFilesFromPost(postID int) error {
|
|||
fileName = fileName[:strings.Index(fileName, ".")]
|
||||
fileType := fileName[strings.Index(fileName, ".")+1:]
|
||||
var thumbType string
|
||||
if fileType == "gif" || fileType == "webm" {
|
||||
if fileType == "gif" || fileType == "webm" || fileType == "mp4" {
|
||||
thumbType = "jpg"
|
||||
}
|
||||
|
||||
|
|
|
@ -188,6 +188,8 @@ var funcMap = template.FuncMap{
|
|||
uploadType = ""
|
||||
case "webm":
|
||||
fallthrough
|
||||
case "mp4":
|
||||
fallthrough
|
||||
case "jpg":
|
||||
fallthrough
|
||||
case "jpeg":
|
||||
|
@ -201,7 +203,7 @@ var funcMap = template.FuncMap{
|
|||
},
|
||||
"imageToThumbnailPath": func(thumbType string, img string) string {
|
||||
filetype := strings.ToLower(img[strings.LastIndex(img, ".")+1:])
|
||||
if filetype == "gif" || filetype == "webm" {
|
||||
if filetype == "gif" || filetype == "webm" || filetype == "mp4" {
|
||||
filetype = "jpg"
|
||||
}
|
||||
index := strings.LastIndex(img, ".")
|
||||
|
|
|
@ -140,7 +140,7 @@ func GetRealIP(request *http.Request) string {
|
|||
// GetThumbnailPath returns the thumbnail path of the given filename
|
||||
func GetThumbnailPath(thumbType string, img string) string {
|
||||
filetype := strings.ToLower(img[strings.LastIndex(img, ".")+1:])
|
||||
if filetype == "gif" || filetype == "webm" {
|
||||
if filetype == "gif" || filetype == "webm" || filetype == "mp4" {
|
||||
filetype = "jpg"
|
||||
}
|
||||
index := strings.LastIndex(img, ".")
|
||||
|
|
|
@ -200,7 +200,7 @@ func MakePost(writer http.ResponseWriter, request *http.Request) {
|
|||
post.FilenameOriginal = html.EscapeString(handler.Filename)
|
||||
filetype := gcutil.GetFileExtension(post.FilenameOriginal)
|
||||
thumbFiletype := strings.ToLower(filetype)
|
||||
if thumbFiletype == "gif" || thumbFiletype == "webm" {
|
||||
if thumbFiletype == "gif" || thumbFiletype == "webm" || thumbFiletype == "mp4" {
|
||||
thumbFiletype = "jpg"
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ func MakePost(writer http.ResponseWriter, request *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if filetype == "webm" {
|
||||
if filetype == "webm" || filetype == "mp4" {
|
||||
if !allowsVids {
|
||||
serverutil.ServeErrorPage(writer, gclog.Print(gclog.LAccessLog,
|
||||
"Video uploading is not currently enabled for this board."))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue