Changed to serve static content from own server in production instead of rawgit

This commit is contained in:
Jesper Wrang 2017-09-10 23:49:47 +02:00
parent dd2320621d
commit 212b8c58da
4 changed files with 5 additions and 7 deletions

View file

@ -65,12 +65,12 @@ func main() {
http.HandleFunc("/", pageHandler(mainHandler))
http.HandleFunc("/r/", pageHandler(threadHandler))
// Serve static files, in production use cdn.rawgit.com (nvm fuck this, always serve static)
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
// Run locally for debugging/testing
if debugMode {
// Serve static files, in production use cdn.rawgit.com
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
fmt.Println("Starting server on http://localhost:8080")
if err := http.ListenAndServe(":8080", nil); err != nil {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 55 KiB

View file

@ -3,9 +3,8 @@
<head>
<title>Removeddit</title>
<meta charset="utf-8">
<!-- https://cdn.rawgit.com/JubbeArt/removeddit/fc5a696e/static/style.css-->
<link href="/static/style.css" rel="stylesheet">
<link rel="shotcut icon" href="https://cdn.rawgit.com/JubbeArt/removeddit/fc5a696e/static/favicon.ico">
<link rel="shotcut icon" href="/static/favicon.ico">
</head>
<body>
<header id="header">

View file

@ -5,5 +5,4 @@
const token = "{{ .Token }}";
const subreddit = "{{ .Subreddit }}";
</script>
<!--https://cdn.rawgit.com/JubbeArt/removeddit/d0d29310/static/script.js-->
<script src="/static/script.js"></script>