Added java badge
This commit is contained in:
parent
a304e81aac
commit
3c6689c75d
292
main.go
292
main.go
|
@ -1,219 +1,219 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"log"
|
||||
"html/template"
|
||||
"strings"
|
||||
"strconv"
|
||||
"html/template"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Index struct {
|
||||
WebpageTitle string
|
||||
WebpageIcon string
|
||||
WebpageKeywords string
|
||||
WebpageDescription string
|
||||
WebpageURL string
|
||||
GalleryItems []GalleryItems
|
||||
SocialItems []SocialItems
|
||||
VideoItems []VideoItems
|
||||
GalleryPhoto *GalleryItems
|
||||
VideoContent *VideoItems
|
||||
Nav bool
|
||||
WebpageTitle string
|
||||
WebpageIcon string
|
||||
WebpageKeywords string
|
||||
WebpageDescription string
|
||||
WebpageURL string
|
||||
GalleryItems []GalleryItems
|
||||
SocialItems []SocialItems
|
||||
VideoItems []VideoItems
|
||||
GalleryPhoto *GalleryItems
|
||||
VideoContent *VideoItems
|
||||
Nav bool
|
||||
}
|
||||
|
||||
type responseWriter struct {
|
||||
http.ResponseWriter
|
||||
status int
|
||||
http.ResponseWriter
|
||||
status int
|
||||
}
|
||||
|
||||
type GalleryItems struct {
|
||||
URL string
|
||||
ID int
|
||||
Title string
|
||||
URL string
|
||||
ID int
|
||||
Title string
|
||||
}
|
||||
|
||||
type SocialItems struct {
|
||||
URL string
|
||||
Name string
|
||||
Username string
|
||||
Icon string
|
||||
Color string
|
||||
URL string
|
||||
Name string
|
||||
Username string
|
||||
Icon string
|
||||
Color string
|
||||
}
|
||||
|
||||
type VideoItems struct {
|
||||
URL string
|
||||
ID int
|
||||
Title string
|
||||
Description string
|
||||
Thumbnail string
|
||||
URL string
|
||||
ID int
|
||||
Title string
|
||||
Description string
|
||||
Thumbnail string
|
||||
}
|
||||
|
||||
var data = &Index {
|
||||
WebpageTitle: "Keyemail",
|
||||
WebpageIcon: "/src/assets/main/favicon.ico",
|
||||
WebpageKeywords: "keyemail",
|
||||
WebpageDescription: "Welcome to keyemail.dev! A profile based on Keyemail.",
|
||||
WebpageURL: "https://keyemail.dev",
|
||||
GalleryItems: galleryItems,
|
||||
SocialItems: socialItems,
|
||||
VideoItems: videoItems,
|
||||
var data = &Index{
|
||||
WebpageTitle: "Keyemail",
|
||||
WebpageIcon: "/src/assets/main/favicon.ico",
|
||||
WebpageKeywords: "keyemail",
|
||||
WebpageDescription: "Welcome to keyemail.dev! A profile based on Keyemail.",
|
||||
WebpageURL: "https://keyemail.dev",
|
||||
GalleryItems: galleryItems,
|
||||
SocialItems: socialItems,
|
||||
VideoItems: videoItems,
|
||||
}
|
||||
|
||||
var currentData = &Index{}
|
||||
|
||||
var galleryItems = []GalleryItems {
|
||||
{"/src/assets/gallery/2_cats.jpg", 1, "Resting Day"},
|
||||
{"/src/assets/gallery/friend_cat.jpg", 2, "Orange Furr"},
|
||||
{"/src/assets/gallery/miku_poster.jpg", 3, "Miku Spotted"},
|
||||
{"/src/assets/gallery/networking.jpg", 4, "Wires of Networking"},
|
||||
{"/src/assets/gallery/another_friend_cat.jpg", 5, "Night Cat"},
|
||||
{"/src/assets/gallery/pc_case_stickers.jpg", 6, "I use arch BTW"},
|
||||
{"/src/assets/gallery/movie_picture_1.jpg", 7, "Prime Cut Cafe"},
|
||||
{"/src/assets/gallery/movie_picture_2.jpg", 8, "Big Fountain"},
|
||||
{"/src/assets/gallery/bird.jpg", 9, "Birds Eye"},
|
||||
{"/src/assets/gallery/japanese_garden_1.jpg", 10, "Pond of Fishes"},
|
||||
{"/src/assets/gallery/japanese_garden_2.jpg", 11, "Waterfall Pond"},
|
||||
{"/src/assets/gallery/japanese_garden_3.jpg", 12, "Bridge of Faith"},
|
||||
{"/src/assets/gallery/japanese_garden_4.jpg", 13, "Little Rocks"},
|
||||
{"/src/assets/gallery/japanese_garden_5.jpg", 14, "Arc over Pond"},
|
||||
{"/src/assets/gallery/japanese_garden_6.jpg", 15, "Beautiful Pond"},
|
||||
var galleryItems = []GalleryItems{
|
||||
{"/src/assets/gallery/2_cats.jpg", 1, "Resting Day"},
|
||||
{"/src/assets/gallery/friend_cat.jpg", 2, "Orange Furr"},
|
||||
{"/src/assets/gallery/miku_poster.jpg", 3, "Miku Spotted"},
|
||||
{"/src/assets/gallery/networking.jpg", 4, "Wires of Networking"},
|
||||
{"/src/assets/gallery/another_friend_cat.jpg", 5, "Night Cat"},
|
||||
{"/src/assets/gallery/pc_case_stickers.jpg", 6, "I use arch BTW"},
|
||||
{"/src/assets/gallery/movie_picture_1.jpg", 7, "Prime Cut Cafe"},
|
||||
{"/src/assets/gallery/movie_picture_2.jpg", 8, "Big Fountain"},
|
||||
{"/src/assets/gallery/bird.jpg", 9, "Birds Eye"},
|
||||
{"/src/assets/gallery/japanese_garden_1.jpg", 10, "Pond of Fishes"},
|
||||
{"/src/assets/gallery/japanese_garden_2.jpg", 11, "Waterfall Pond"},
|
||||
{"/src/assets/gallery/japanese_garden_3.jpg", 12, "Bridge of Faith"},
|
||||
{"/src/assets/gallery/japanese_garden_4.jpg", 13, "Little Rocks"},
|
||||
{"/src/assets/gallery/japanese_garden_5.jpg", 14, "Arc over Pond"},
|
||||
{"/src/assets/gallery/japanese_garden_6.jpg", 15, "Beautiful Pond"},
|
||||
}
|
||||
|
||||
var socialItems = []SocialItems {
|
||||
{"https://discord.gg/VTEn4zuh", "Discord", "keyemail", "/src/assets/icons/discord.svg", "5865F2"},
|
||||
{"https://github.com/Keyemail", "GitHub", "Keyemail", "/src/assets/icons/github.svg", "171515"},
|
||||
{"https://steamcommunity.com/id/keyemail/", "Steam", "Keyemail", "/src/assets/icons/steam.svg", "000000"},
|
||||
{"https://open.spotify.com/user/316yuurxrw3zcprxsnrvgamxktp4", "Spotify", "Keyemail", "/src/assets/icons/spotify.svg", "1DB954"},
|
||||
{"https://www.youtube.com/channel/UCCNkKG8XoZCh52vLCbXYy7g", "YouTube", "Keyemail", "/src/assets/icons/youtube.svg", "CD201F"},
|
||||
{"https://www.instagram.com/keyemail1?igsh=OGQ5ZDc2ODk2ZA%3D%3D&utm_source=qr", "Instagram", "keyemail1", "/src/assets/icons/instagram.svg", "C13584"},
|
||||
var socialItems = []SocialItems{
|
||||
{"https://discord.gg/VTEn4zuh", "Discord", "keyemail", "/src/assets/icons/discord.svg", "5865F2"},
|
||||
{"https://github.com/Keyemail", "GitHub", "Keyemail", "/src/assets/icons/github.svg", "171515"},
|
||||
{"https://steamcommunity.com/id/keyemail/", "Steam", "Keyemail", "/src/assets/icons/steam.svg", "000000"},
|
||||
{"https://open.spotify.com/user/316yuurxrw3zcprxsnrvgamxktp4", "Spotify", "Keyemail", "/src/assets/icons/spotify.svg", "1DB954"},
|
||||
{"https://www.youtube.com/channel/UCCNkKG8XoZCh52vLCbXYy7g", "YouTube", "Keyemail", "/src/assets/icons/youtube.svg", "CD201F"},
|
||||
{"https://www.instagram.com/keyemail1?igsh=OGQ5ZDc2ODk2ZA%3D%3D&utm_source=qr", "Instagram", "keyemail1", "/src/assets/icons/instagram.svg", "C13584"},
|
||||
}
|
||||
|
||||
var videoItems = []VideoItems {
|
||||
{"/src/assets/videos/JP-Installing-Windows-Project.mp4", 1, "JP Installing Windows Project", "This is a guide in japanese where I teach you how to install windows completely. This was made because of a JP Project I had to do.", "/src/assets/video_thumbnails/JP-Installing-Windows-Project.png"},
|
||||
{"/src/assets/videos/orange-cat.mp4", 2, "Orange Cat", "Cute little orange cat that my friend has!! Hes so cute lol.", "/src/assets/video_thumbnails/orange-cat.png"},
|
||||
var videoItems = []VideoItems{
|
||||
{"/src/assets/videos/JP-Installing-Windows-Project.mp4", 1, "JP Installing Windows Project", "This is a guide in japanese where I teach you how to install windows completely. This was made because of a JP Project I had to do.", "/src/assets/video_thumbnails/JP-Installing-Windows-Project.png"},
|
||||
{"/src/assets/videos/orange-cat.mp4", 2, "Orange Cat", "Cute little orange cat that my friend has!! Hes so cute lol.", "/src/assets/video_thumbnails/orange-cat.png"},
|
||||
}
|
||||
|
||||
func renderTemplate(w http.ResponseWriter, tmpl string, data *Index, nav bool) {
|
||||
var templateFiles[]string
|
||||
var templateFiles []string
|
||||
|
||||
templateFiles = append(templateFiles, "src/pages/" + tmpl + ".tmpl", "src/index.tmpl", "src/components/navbar.tmpl")
|
||||
templateFiles = append(templateFiles, "src/pages/"+tmpl+".tmpl", "src/index.tmpl", "src/components/navbar.tmpl")
|
||||
|
||||
templates, err := template.ParseFiles(templateFiles...)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
templates, err := template.ParseFiles(templateFiles...)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
data.Nav = nav
|
||||
data.Nav = nav
|
||||
|
||||
err = templates.ExecuteTemplate(w, "base", data)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
err = templates.ExecuteTemplate(w, "base", data)
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
log.Println("GET /" + tmpl)
|
||||
log.Println("GET /" + tmpl)
|
||||
}
|
||||
|
||||
func galleryContentHandler(w http.ResponseWriter, req *http.Request) {
|
||||
parts := strings.Split(req.URL.Path, "/")
|
||||
parts := strings.Split(req.URL.Path, "/")
|
||||
|
||||
if len(parts) == 3 && parts[1] == "gallery" {
|
||||
idStr := parts[2]
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil || id < 1 || id > len(galleryItems) {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
if len(parts) == 3 && parts[1] == "gallery" {
|
||||
idStr := parts[2]
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil || id < 1 || id > len(galleryItems) {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
|
||||
var item GalleryItems
|
||||
for _, gi := range galleryItems {
|
||||
if gi.ID == id {
|
||||
item = gi
|
||||
break
|
||||
}
|
||||
}
|
||||
var item GalleryItems
|
||||
for _, gi := range galleryItems {
|
||||
if gi.ID == id {
|
||||
item = gi
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
*currentData = *data
|
||||
currentData.GalleryPhoto = &item
|
||||
currentData.GalleryItems = nil
|
||||
*currentData = *data
|
||||
currentData.GalleryPhoto = &item
|
||||
currentData.GalleryItems = nil
|
||||
|
||||
renderTemplate(w, "gallery_content", currentData, true)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "gallery_content", currentData, true)
|
||||
return
|
||||
}
|
||||
|
||||
renderTemplate(w, "404", data, true)
|
||||
renderTemplate(w, "404", data, true)
|
||||
}
|
||||
|
||||
func videoContentHandler(w http.ResponseWriter, req *http.Request) {
|
||||
parts := strings.Split(req.URL.Path, "/")
|
||||
parts := strings.Split(req.URL.Path, "/")
|
||||
|
||||
if len(parts) == 3 && parts[1] == "videos" {
|
||||
idStr := parts[2]
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err!= nil || id < 1 || id > len(videoItems) {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
if len(parts) == 3 && parts[1] == "videos" {
|
||||
idStr := parts[2]
|
||||
id, err := strconv.Atoi(idStr)
|
||||
if err != nil || id < 1 || id > len(videoItems) {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
|
||||
var item VideoItems
|
||||
for _, gi := range videoItems {
|
||||
if gi.ID == id {
|
||||
item = gi
|
||||
break
|
||||
}
|
||||
}
|
||||
var item VideoItems
|
||||
for _, gi := range videoItems {
|
||||
if gi.ID == id {
|
||||
item = gi
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
*currentData = *data
|
||||
currentData.VideoContent = &item
|
||||
currentData.VideoItems = nil
|
||||
*currentData = *data
|
||||
currentData.VideoContent = &item
|
||||
currentData.VideoItems = nil
|
||||
|
||||
renderTemplate(w, "video_content", currentData, true)
|
||||
return
|
||||
}
|
||||
renderTemplate(w, "video_content", currentData, true)
|
||||
return
|
||||
}
|
||||
|
||||
renderTemplate(w, "404", data, true)
|
||||
renderTemplate(w, "404", data, true)
|
||||
}
|
||||
|
||||
func videoHandler(w http.ResponseWriter, req *http.Request) {
|
||||
renderTemplate(w, "video", data, true)
|
||||
renderTemplate(w, "video", data, true)
|
||||
}
|
||||
|
||||
func socialsHandler(w http.ResponseWriter, req *http.Request) {
|
||||
renderTemplate(w, "socials", data, true)
|
||||
renderTemplate(w, "socials", data, true)
|
||||
}
|
||||
|
||||
func galleryHandler(w http.ResponseWriter, req *http.Request) {
|
||||
renderTemplate(w, "gallery", data, true)
|
||||
renderTemplate(w, "gallery", data, true)
|
||||
}
|
||||
|
||||
func indexHandler(w http.ResponseWriter, req *http.Request) {
|
||||
if req.URL.Path != "/" {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
if req.URL.Path != "/" {
|
||||
renderTemplate(w, "404", data, true)
|
||||
return
|
||||
}
|
||||
|
||||
renderTemplate(w, "home", data, true)
|
||||
renderTemplate(w, "home", data, true)
|
||||
}
|
||||
|
||||
func main() {
|
||||
if _, err := os.Stat("src/index.tmpl"); os.IsNotExist(err) {
|
||||
log.Fatal("Template file does not exist:\n", err)
|
||||
}
|
||||
if _, err := os.Stat("src/index.tmpl"); os.IsNotExist(err) {
|
||||
log.Fatal("Template file does not exist:\n", err)
|
||||
}
|
||||
|
||||
fs := http.FileServer(http.Dir("./src"))
|
||||
http.Handle("/src/", http.StripPrefix("/src/", fs))
|
||||
fs := http.FileServer(http.Dir("./src"))
|
||||
http.Handle("/src/", http.StripPrefix("/src/", fs))
|
||||
|
||||
port := ":3939"
|
||||
port := ":3939"
|
||||
|
||||
http.HandleFunc("/", indexHandler)
|
||||
http.HandleFunc("/socials", socialsHandler)
|
||||
http.HandleFunc("/gallery", galleryHandler)
|
||||
http.HandleFunc("/videos", videoHandler)
|
||||
http.HandleFunc("/gallery/", galleryContentHandler)
|
||||
http.HandleFunc("/videos/", videoContentHandler)
|
||||
http.HandleFunc("/", indexHandler)
|
||||
http.HandleFunc("/socials", socialsHandler)
|
||||
http.HandleFunc("/gallery", galleryHandler)
|
||||
http.HandleFunc("/videos", videoHandler)
|
||||
http.HandleFunc("/gallery/", galleryContentHandler)
|
||||
http.HandleFunc("/videos/", videoContentHandler)
|
||||
|
||||
log.Println("Server running at http://localhost" + port)
|
||||
http.ListenAndServe(port, nil)
|
||||
log.Println("Server running at http://localhost" + port)
|
||||
http.ListenAndServe(port, nil)
|
||||
}
|
||||
|
|
1
src/assets/badges/java.svg
Normal file
1
src/assets/badges/java.svg
Normal file
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="#ed2025" d="M277.7 312.9c9.8-6.7 23.4-12.5 23.4-12.5s-38.7 7-77.2 10.2c-47.1 3.9-97.7 4.7-123.1 1.3-60.1-8 33-30.1 33-30.1s-36.1-2.4-80.6 19c-52.5 25.4 130 37 224.5 12.1zm-85.4-32.1c-19-42.7-83.1-80.2 0-145.8C296 53.2 242.8 0 242.8 0c21.5 84.5-75.6 110.1-110.7 162.6-23.9 35.9 11.7 74.4 60.2 118.2zm114.6-176.2c.1 0-175.2 43.8-91.5 140.2 24.7 28.4-6.5 54-6.5 54s62.7-32.4 33.9-72.9c-26.9-37.8-47.5-56.6 64.1-121.3zm-6.1 270.5a12.2 12.2 0 0 1 -2 2.6c128.3-33.7 81.1-118.9 19.8-97.3a17.3 17.3 0 0 0 -8.2 6.3 70.5 70.5 0 0 1 11-3c31-6.5 75.5 41.5-20.6 91.4zM348 437.4s14.5 11.9-15.9 21.2c-57.9 17.5-240.8 22.8-291.6 .7-18.3-7.9 16-19 26.8-21.3 11.2-2.4 17.7-2 17.7-2-20.3-14.3-131.3 28.1-56.4 40.2C232.8 509.4 401 461.3 348 437.4zM124.4 396c-78.7 22 47.9 67.4 148.1 24.5a185.9 185.9 0 0 1 -28.2-13.8c-44.7 8.5-65.4 9.1-106 4.5-33.5-3.8-13.9-15.2-13.9-15.2zm179.8 97.2c-78.7 14.8-175.8 13.1-233.3 3.6 0-.1 11.8 9.7 72.4 13.6 92.2 5.9 233.8-3.3 237.1-46.9 0 0-6.4 16.5-76.2 29.7zM260.6 353c-59.2 11.4-93.5 11.1-136.8 6.6-33.5-3.5-11.6-19.7-11.6-19.7-86.8 28.8 48.2 61.4 169.5 25.9a60.4 60.4 0 0 1 -21.1-12.8z"/></svg>
|
After Width: | Height: | Size: 1.2 KiB |
|
@ -58,6 +58,10 @@
|
|||
<img src="/src/assets/badges/nginx.svg" aria-label="NGINX"/>
|
||||
<div>nginx</div>
|
||||
</li>
|
||||
<li>
|
||||
<img src="/src/assets/badges/java.svg" aria-label="JAVA"/>
|
||||
<div>Java</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</header>
|
||||
|
|
Loading…
Reference in a new issue