-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge PR #31: Project and build improvements
- Loading branch information
Showing
10 changed files
with
140 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
|
||
# Generated site | ||
/public/ | ||
/mumble-www.7z |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
all: public mumble-www | ||
all: public mumble-www package | ||
|
||
public: $(shell find hugo/ -type f) | ||
(cd hugo/; hugo) | ||
|
||
mumble-www: mumble-www.go githubcache.go snapshotcache.go | ||
mumble-www: src/mumble-www.go src/githubcache.go src/snapshotcache.go | ||
go build -o $@ $^ | ||
|
||
package: public mumble-www | ||
7z a mumble-www.7z public mumble-www |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# The Mumble Website | ||
|
||
**This is a work in progress not yet released.** | ||
|
||
Source of the Mumble Website available at [mumble.info](https://mumble.info/). | ||
|
||
Implemented and served through a combination of a Go webserver for dynamic content and static files generated with [hugo](https://gohugo.io/). | ||
|
||
## Webserver | ||
|
||
* Cache the `LICENSE` and `AUTHORS` files from github and serve them | ||
* Redirect predefined stable download URLs to download files | ||
* Redirect predefined snapshot download URLs; cached self-updating target URLs | ||
* * Redirect Ubuntu snapshots to the PPA | ||
* Serve static website files | ||
|
||
The go source files reside in the `src` folder. | ||
|
||
## Website | ||
|
||
The website source resides in the `hugo` folder, is buildable with hugo. The target folder is `public`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
@echo off | ||
SETLOCAL | ||
|
||
PUSHD %~dp0 | ||
|
||
PUSHD hugo | ||
hugo | ||
IF ERRORLEVEL 1 (PAUSE && EXIT /B 1) | ||
POPD | ||
|
||
go build src/mumble-www.go src/githubcache.go src/snapshotcache.go | ||
IF ERRORLEVEL 1 (PAUSE && EXIT /B 1) | ||
|
||
SET GOOS=linux | ||
go build src/mumble-www.go src/githubcache.go src/snapshotcache.go | ||
IF ERRORLEVEL 1 (PAUSE && EXIT /B 1) | ||
|
||
DEL mumble-www.7z 1>NUL | ||
7z.exe a mumble-www.7z public mumble-www | ||
|
||
POPD |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module "https: //github.com/mumble-voip/mumble-www" | ||
|
||
require ( | ||
github.com/PuerkitoBio/goquery v1.5.0 | ||
github.com/google/go-github v17.0.0+incompatible | ||
github.com/google/go-querystring v1.0.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
github.com/PuerkitoBio/goquery v1.5.0 h1:uGvmFXOA73IKluu/F84Xd1tt/z07GYm8X49XKHP7EJk= | ||
github.com/PuerkitoBio/goquery v1.5.0/go.mod h1:qD2PgZ9lccMbQlc7eEOjaeRlFQON7xY8kdmcsrnKqMg= | ||
github.com/andybalholm/cascadia v1.0.0 h1:hOCXnnZ5A+3eVDX8pvgl4kofXv2ELss0bKcqRySc45o= | ||
github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= | ||
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= | ||
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ= | ||
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= | ||
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= | ||
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= | ||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a h1:gOpx8G595UYyvj8UK4+OFyY4rx037g3fmfhe5SasG3U= | ||
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// Copyright 2005-2018 The Mumble Developers. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license | ||
// that can be found in the LICENSE file at the root of the | ||
// Mumble source tree or at <https://www.mumble.info/LICENSE>. | ||
|
||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
"net/http" | ||
"time" | ||
) | ||
|
||
func setup(mux *http.ServeMux) { | ||
setupDownloadsStable(mux) | ||
setupDownloadsSnapshot(mux) | ||
setupGithubCache(mux) | ||
setupStaticFiles(mux) | ||
} | ||
|
||
func setupDownloadsStable(mux *http.ServeMux) { | ||
stable := map[string]string{ | ||
"windows-32": "https://github.com/mumble-voip/mumble/releases/download/1.2.19/mumble-1.2.19.msi", | ||
"osx": "https://github.com/mumble-voip/mumble/releases/download/1.2.19/Mumble-1.2.19.dmg", | ||
"osx-universal": "https://github.com/mumble-voip/mumble/releases/download/1.2.10/Mumble-Universal-1.2.10.dmg", | ||
"ios": "http://itunes.apple.com/us/app/mumble/id443472808?ls=1&mt=8", | ||
"ubuntu": "https://launchpad.net/~mumble/+archive/release", | ||
"linux-static-server": "https://github.com/mumble-voip/mumble/releases/download/1.2.19/murmur-static_x86-1.2.19.tar.bz2", | ||
"osx-static-server": "https://github.com/mumble-voip/mumble/releases/download/1.2.19/Murmur-OSX-Static-1.2.19.tar.bz2", | ||
} | ||
|
||
for source, target := range stable { | ||
mux.Handle("/downloads/"+source, http.RedirectHandler(target, http.StatusTemporaryRedirect)) | ||
} | ||
} | ||
|
||
func setupDownloadsSnapshot(mux *http.ServeMux) { | ||
snapshotCache := NewSnapshotCache(time.Hour) | ||
for source := range snapshotRegexps { | ||
mux.Handle("/downloads/"+source+"/snapshot", snapshotCache.Handle(source)) | ||
} | ||
mux.Handle( | ||
"/downloads/ubuntu/snapshot", | ||
http.RedirectHandler("https://launchpad.net/~mumble/+archive/snapshot", http.StatusTemporaryRedirect), | ||
) | ||
} | ||
|
||
func setupGithubCache(mux *http.ServeMux) { | ||
githubCache := NewGithubCache(time.Minute * 10) | ||
mux.Handle("/LICENSE", githubCache.Handle("/LICENSE")) | ||
mux.Handle("/AUTHORS", githubCache.Handle("/AUTHORS")) | ||
} | ||
|
||
func setupStaticFiles(mux *http.ServeMux) { | ||
public := flag.String("public", "public", "public directory") | ||
fs := http.FileServer(http.Dir(*public)) | ||
mux.Handle("/", fs) | ||
} | ||
|
||
func main() { | ||
addr := flag.String("addr", "127.0.0.1:8081", "bind address") | ||
flag.Parse() | ||
|
||
log.Printf("Starting server on %s\n", *addr) | ||
|
||
mux := http.NewServeMux() | ||
|
||
setup(mux) | ||
|
||
if err := http.ListenAndServe(*addr, mux); err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
File renamed without changes.