Browse Source

Make the website fully functional

pull/1/head
Tovi Jaeschke-Rogers 4 years ago
parent
commit
f61c93eca1
28 changed files with 588 additions and 404 deletions
  1. +51
    -1
      Database/Post.go
  2. +22
    -0
      Helper/FileHelper.go
  3. +62
    -0
      Helper/TemplateFormatter.go
  4. +0
    -27
      Helper/TimeHelper.go
  5. +4
    -2
      Webserver/Admin.go
  6. +4
    -4
      Webserver/Index.go
  7. +73
    -2
      Webserver/Post.go
  8. +27
    -2
      Webserver/ServeFile.go
  9. +2
    -0
      Webserver/Webserver.go
  10. +7
    -1
      web/css/admin-new-post.css
  11. +2
    -0
      web/css/admin.css
  12. +27
    -4
      web/css/main.css
  13. +2
    -2
      web/html/admin/admin-new-post.gohtml
  14. +1
    -1
      web/html/admin/admin-update-post.gohtml
  15. +4
    -6
      web/html/header.gohtml
  16. +0
    -59
      web/html/hireme.html
  17. +6
    -0
      web/html/index-intro.gohtml
  18. +16
    -0
      web/html/index-post-list.gohtml
  19. +14
    -15
      web/html/index.gohtml
  20. +0
    -66
      web/html/pentesting.html
  21. +0
    -66
      web/html/personal.html
  22. +23
    -0
      web/html/post-list.gohtml
  23. +8
    -0
      web/html/post.gohtml
  24. +0
    -80
      web/html/post.html
  25. +0
    -66
      web/html/programming.html
  26. +37
    -0
      web/js/code_resize.js
  27. +174
    -0
      web/js/prism.js
  28. +22
    -0
      web/js/script.js

+ 51
- 1
Database/Post.go View File

@ -1,5 +1,7 @@
package Database
import "time"
func GetPostById(id string) (Post, error) {
var (
post Post
@ -21,7 +23,24 @@ func GetPostsList(limit int, offset int) ([]Post, error) {
)
e = DB.Model(&Post{}).
Order("created_at desc").
Order("updated_at desc").
Limit(limit).
Offset(offset).
Find(&posts).
Error
return posts, e
}
func GetPostsListBySubject(limit int, offset int, subject string) ([]Post, error) {
var (
posts []Post
e error
)
e = DB.Model(&Post{}).
Where("subject = ?", subject).
Order("updated_at desc").
Limit(limit).
Offset(offset).
Find(&posts).
@ -30,6 +49,20 @@ func GetPostsList(limit int, offset int) ([]Post, error) {
return posts, e
}
func GetPostCountBySubject(subject string) (int64, error) {
var (
count int64
e error
)
e = DB.Model(&Post{}).
Where("subject = ?", subject).
Count(&count).
Error
return count, e
}
func CreatePost(post Post) error {
return DB.Model(&Post{}).
Create(&post).
@ -39,3 +72,20 @@ func CreatePost(post Post) error {
func UpdatePost(post Post) error {
return DB.Save(&post).Error
}
func GetLastUpdatedAt() (time.Time, error) {
var (
post Post
e error
)
e = DB.Model(&Post{}).
Select("updated_at").
Order("updated_at desc").
Limit(1).
Offset(0).
First(&post).
Error
return post.UpdatedAt, e
}

+ 22
- 0
Helper/FileHelper.go View File

@ -94,3 +94,25 @@ func GetFileContents(path string) (string, error) {
// Convert []byte to string and print to screen
return string(content), nil
}
func DeleteOldPostFile(title string) error {
var (
filename, path string
e error
)
filename = strings.ReplaceAll(title, " ", "_") + ".gohtml"
path = filepath.Join(
Variables.ProjectRoot,
"web/posts/",
filename,
)
e = os.Remove(path)
if e != nil {
return e
}
return nil
}

+ 62
- 0
Helper/TemplateFormatter.go View File

@ -0,0 +1,62 @@
package Helper
import (
"strconv"
"strings"
"time"
)
func MinusInt64(a, b int64) string {
return strconv.FormatInt(a-b, 10)
}
func MinusInt(a, b int) string {
return strconv.Itoa(a - b)
}
func Minus(a, b int) int {
return a - b
}
func PlusInt64(a, b int64) string {
return strconv.FormatInt(a+b, 10)
}
func PlusInt(a, b int) string {
return strconv.Itoa(a + b)
}
func Iterate(count int) []int {
var i int
var Items []int
for i = 0; i < count; i++ {
Items = append(Items, i)
}
return Items
}
func StrToLower(s string) string {
return strings.ToLower(s)
}
func FormatTimestamp(t interface{}) string {
var (
s string
tt time.Time
exists bool
)
// Check if timestamp is string
s, exists = t.(string)
if exists {
return s
}
// Check if timestamp is time.Time
tt, exists = t.(time.Time)
if !exists || tt.IsZero() {
return ""
}
loc, _ := time.LoadLocation("Australia/Adelaide")
return tt.
In(loc).
Format("02/01/2006 03:04 PM")
}

+ 0
- 27
Helper/TimeHelper.go View File

@ -1,27 +0,0 @@
package Helper
import (
"time"
)
func FormatTimestamp(t interface{}) string {
var (
s string
tt time.Time
exists bool
)
// Check if timestamp is string
s, exists = t.(string)
if exists {
return s
}
// Check if timestamp is time.Time
tt, exists = t.(time.Time)
if !exists || tt.IsZero() {
return ""
}
loc, _ := time.LoadLocation("Australia/Adelaide")
return tt.
In(loc).
Format("02/01/2006 03:04 PM")
}

+ 4
- 2
Webserver/Admin.go View File

@ -322,6 +322,10 @@ func AdminEditPost(w http.ResponseWriter, r *http.Request) {
intro = r.FormValue("intro")
body = r.FormValue("body")
if title != post.Title {
defer Helper.DeleteOldPostFile(post.Title)
}
bodyPath, e = Helper.WriteBody(title, body)
if e != nil {
log.Fatal(e)
@ -340,8 +344,6 @@ func AdminEditPost(w http.ResponseWriter, r *http.Request) {
Helper.UploadFiles(fileUpload)
fmt.Println(post)
post.Title = title
post.Subject = subject
post.Intro = intro


+ 4
- 4
Webserver/Index.go View File

@ -1,7 +1,6 @@
package Webserver
import (
"log"
"net/http"
"PersonalWebsite/Database"
@ -13,10 +12,11 @@ func ViewIndex(w http.ResponseWriter, r *http.Request) {
e error
)
v["SidebarLinks"], e = Database.GetAllSidebarLinks()
v["PageView"] = "index-intro.gohtml"
v["Posts"], e = Database.GetPostsList(5, 0)
if e != nil {
// TODO: Handle
log.Fatal(e)
// TODO: Handle this
http.Error(w, "Error", http.StatusInternalServerError)
}
ServeTemplate(w, r, "html/index.gohtml", v)


+ 73
- 2
Webserver/Post.go View File

@ -3,6 +3,7 @@ package Webserver
import (
"log"
"net/http"
"strconv"
"PersonalWebsite/Database"
@ -11,6 +12,7 @@ import (
func ViewPost(w http.ResponseWriter, r *http.Request) {
var (
v = make(map[string]interface{})
urlParams map[string]string
post Database.Post
e error
@ -21,10 +23,79 @@ func ViewPost(w http.ResponseWriter, r *http.Request) {
post, e = Database.GetPostById(urlParams["id"])
if e != nil {
// TODO: Forward 404
log.Println("Could not get user")
log.Println("Could not get post")
http.Error(w, "Error", http.StatusInternalServerError)
return
}
log.Println(post)
v["Subject"] = post.Subject
v["PageView"] = "post.gohtml"
v["Post"] = post
ServeTemplate(w, r, "html/index.gohtml", v)
}
func ViewPostList(w http.ResponseWriter, r *http.Request, subject string) {
var (
limit int = 2
v = make(map[string]interface{})
posts []Database.Post
postsCount int64
pageCount int
keys []string
page int
offset int
x, y int
ok bool
e error
)
keys, ok = r.URL.Query()["page"]
if !ok || len(keys[0]) < 1 {
page = 0
} else {
page, e = strconv.Atoi(keys[0])
if e != nil {
// TODO: Handle this
http.Error(w, "Error", http.StatusInternalServerError)
return
}
}
offset = limit * page
posts, e = Database.GetPostsListBySubject(limit, offset, subject)
if e != nil {
// TODO: Handle this
http.Error(w, "Error", http.StatusInternalServerError)
return
}
postsCount, e = Database.GetPostCountBySubject(subject)
if e != nil {
// TODO: Handle this
http.Error(w, "Error", http.StatusInternalServerError)
return
}
x, y = int(postsCount), limit
pageCount = (x + y - 1) / y
v["PageView"] = "post-list.gohtml"
v["Subject"] = subject
v["Posts"] = posts
v["Page"] = page
v["PageCount"] = pageCount
ServeTemplate(w, r, "html/index.gohtml", v)
}
func ViewPostListProgramming(w http.ResponseWriter, r *http.Request) {
ViewPostList(w, r, "Programming")
}
func ViewPostListPentesting(w http.ResponseWriter, r *http.Request) {
ViewPostList(w, r, "Pentesting")
}

+ 27
- 2
Webserver/ServeFile.go View File

@ -1,10 +1,11 @@
package Webserver
import (
"html/template"
"net/http"
"path"
"text/template"
"PersonalWebsite/Database"
"PersonalWebsite/Helper"
)
@ -16,6 +17,10 @@ var (
partials = []string{
"html/header.gohtml",
"html/sidebar.gohtml",
"html/index-intro.gohtml",
"html/index-post-list.gohtml",
"html/post-list.gohtml",
"html/post.gohtml",
}
)
@ -26,7 +31,20 @@ func ServeTemplate(w http.ResponseWriter, r *http.Request, mainFile string, v ma
e error
)
v["test"] = "Yeet"
if _, ok := v["Subject"]; !ok {
v["Subject"] = ""
}
v["LastUpdatedAt"], e = Database.GetLastUpdatedAt()
if e != nil {
v["LastUpdatedAt"] = " - "
}
v["SidebarLinks"], e = Database.GetAllSidebarLinks()
if e != nil {
// TODO: Handle
panic(e)
}
files = []string{webRootJoin(mainFile)}
for _, p := range partials {
@ -36,6 +54,13 @@ func ServeTemplate(w http.ResponseWriter, r *http.Request, mainFile string, v ma
tpl, e = template.New(path.Base(files[0])).Funcs(
template.FuncMap{
"FormatTimestamp": Helper.FormatTimestamp,
"MinusInt64": Helper.MinusInt64,
"MinusInt": Helper.MinusInt,
"Minus": Helper.MinusInt,
"PlusInt64": Helper.PlusInt64,
"PlusInt": Helper.PlusInt,
"Iterate": Helper.Iterate,
"StrToLower": Helper.StrToLower,
},
).ParseFiles(files...)
if e != nil {


+ 2
- 0
Webserver/Webserver.go View File

@ -58,6 +58,8 @@ func Start() error {
// Interface endpoints
r.HandleFunc("/", ViewIndex)
r.HandleFunc("/programming", ViewPostListProgramming)
r.HandleFunc("/pentesting", ViewPostListPentesting)
r.HandleFunc("/post/{id}", ViewPost)
// Administration


+ 7
- 1
web/css/admin-new-post.css View File

@ -2,10 +2,16 @@ input, label {
display:block;
}
label {
padding-top: 0.5em;
}
input, textarea {
margin-top: 0.4em;
margin-bottom: 1em;
width: 100%;
}
input[type=submit] {
height: 2.5em;
}

+ 2
- 0
web/css/admin.css View File

@ -8,6 +8,7 @@ body {
padding: 0;
margin: 0;
font-family: "Montserrat", sans-serif;
min-height: calc(100vh + 8em);
}
body * {
@ -28,6 +29,7 @@ header {
width: 100%;
background: #323232;
height: 4em;
z-index: 9999;
}
header h3 {


+ 27
- 4
web/css/main.css View File

@ -67,6 +67,7 @@ header h2:hover {
padding-left: 15px;
padding-right: 15px;
padding-top: 10px;
margin-right: 20px;
-webkit-transition: padding 1s linear, border 0.5s linear;
-webkit-transition-timing-function: linear;
transition: padding 0.3s linear, border 0.3s linear;
@ -154,9 +155,9 @@ header h2:hover {
.main a:hover {
color: #0091c9;
text-decoration: underline;
}
.main img {
max-width: 100%;
}
@ -238,6 +239,7 @@ pre::-webkit-scrollbar-color {
.post-title {
padding: 10px;
text-align: center;
font-size: 2em;
}
.post-icon {
@ -248,6 +250,14 @@ pre::-webkit-scrollbar-color {
text-align: center;
}
.index-recent-posts {
padding: 0;
}
.index-recent-post-title-container {
padding-bottom: 1em;
}
.index-recent-posts li
{
list-style: none;
@ -255,23 +265,36 @@ pre::-webkit-scrollbar-color {
-webkit-transition-timing-function: linear;
transition: background 0.3s linear;
transition-timing-function: linear;
padding: 10px;
margin-bottom: 10px;
padding: 1em;
background: rgba(0, 0, 0, 0.65);
margin-bottom: 1.5em;
}
.index-recent-posts li:hover {
background: rgba(0, 0, 0, 0.9);
}
.index-recent-posts a:hover {
text-decoration: none;
}
.index-post-intro * {
color: #ffffff;
margin: 0;
}
.index-recent-posts-title {
font-size: 1.3em;
width: 80%;
display: inline;
margin: 0;
}
.datetimebox {
display: inline-block;
display: inline;
float: right;
font-size: 0.9em;
margin: 0;
}
@media all and (max-width : 950px) {


+ 2
- 2
web/html/admin/admin-new-post.gohtml View File

@ -25,14 +25,14 @@
<fieldset>
<legend>New Post</legend>
<label for="title">Title</label>
<input type="text" name="title" value="{{ .Title }}">
<input type="text" name="title">
<label for="subject">Subject</label>
<select name="subject">
<option value="Programming">Programming</option>
<option value="Pentesting">Pentesting</option>
</select>
<label for="intro">Intro</label>
<input type="text" name="intro" value="{{ .Intro }}">
<textarea name="intro" rows="6"></textarea><br/><br/>
<label for="body">Body: </label>
<textarea name="body" rows="20"></textarea><br/><br/>
<label for="img">Main Image: </label>


+ 1
- 1
web/html/admin/admin-update-post.gohtml View File

@ -39,7 +39,7 @@
>Pentesting</option>
</select>
<label for="intro">Intro</label>
<input type="text" name="intro" value="{{ .Post.Intro }}">
<textarea name="intro" rows="6">{{ .Post.Intro }}</textarea><br/><br/>
<label for="body">Body: </label>
<textarea name="body" rows="20">{{ .Post.Body }}</textarea><br/><br/>
<label for="img">Main Image: </label>


+ 4
- 6
web/html/header.gohtml View File

@ -5,15 +5,13 @@
</div>
<div class="links">
<ul>
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/pentesting?page=0"><li class="{{ if eq .Subject "Pentesting" }}active{{ end }}">Pentesting</li></a>
<a href="/programming?page=0"><li class="{{ if eq .Subject "Programming" }}active{{ end }}">Programming</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/pentesting?page=0"><li class="{{ if eq .Subject "Pentesting" }}active{{ end }}">Pentesting</li></a>
<a href="/programming?page=0"><li class="{{ if eq .Subject "Programming" }}active{{ end }}">Programming</li></a>
</ul>
</header>

+ 0
- 59
web/html/hireme.html View File

@ -1,59 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="js/prism.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<header>
<a href="/"><h2 href="/">Tovi Jaeschke</h2></a>
<div class="nav-toggle">
<div class="nav-toggle-bar"></div>
</div>
<div class="links">
<ul>
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li class="active">Hire Me</li></a>
</ul>
</header>
<div class="container">
<div class="left-bar">
<p>Links:</p>
<ul class="expand-links">
<a href="mailto:tovi@tovijaeschke.xyz"><li>Email</li></a>
<a href="https://git.tovijaeschke.xyz"><li>Git</li></a>
<a href="https://gitlab.com/tovijaeschke"><li>Gitlab</li></a>
<a href="/static/Resume.pdf"><li>Resume</li></a>
<a href="https://demos.tovijaeschke.xyz/"><li>Portfolio</li></a>
</ul>
<p>Recent posts:</p>
<ul>
<?php include 'php/recent-posts.php';?>
</ul>
</div>
<div class="main">
<h2>Hire Me!</h2>
<p>If you have any work pertaining to Web Development, Cyber Security, or Programming in Go, Python, or PHP, Please take a look at my Resume <a href="/static/Resume.pdf">here</a> and email me at <a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a></p>
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
</footer>
</body>
</html>

+ 6
- 0
web/html/index-intro.gohtml View File

@ -0,0 +1,6 @@
<h2>Tovi Jaeschke</h2>
<p>Hello! My name is Tovi. I'm a 21 year old programmer and computer security enthusiast.</p>
<p>My main hobbies include reading, programming, pentesting, philosophy, and designing websites. I actively develop in Go, Python, php, and HTML/CSS/JS. I enjoy using versatile, minimalist, open source programs, such as vim, st, dmenu, and dwm.</p>
<p>You can find some of my portfolio and some front-end demos <a href="https://demos.tovijaeschke.xyz">here</a></p>
<p>On this site, you will find programs I have written, CTF walkthroughs, minimalist programs I have found and begun using, and updates about my current workflow.</p>
{{ template "index-post-list.gohtml" . }}

+ 16
- 0
web/html/index-post-list.gohtml View File

@ -0,0 +1,16 @@
<h3>Recent posts:</h3>
<ul class="index-recent-posts">
{{ range $post := .Posts }}
<a href='/post/{{ $post.ID }}'>
<li>
<div class='index-recent-post-title-container'>
<h4 class='index-recent-posts-title'>{{ $post.Title}}</h4>
<p class='datetimebox recent-post-updated-at'>{{ FormatTimestamp $post.UpdatedAt }}</p>
</div>
<div class='index-post-intro'>
{{ $post.Intro }}
</div>
</li>
</a>
{{ end }}
</ul>

+ 14
- 15
web/html/index.gohtml View File

@ -3,31 +3,30 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="/css/main.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="js/prism.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<link rel="stylesheet" href="/css/prism.css">
<script src="/js/prism.js"></script>
<script type="text/javascript" src="/js/script.js"></script>
<script type="text/javascript" src="/js/code_resize.js"></script>
</head>
<body>
{{ template "header.gohtml" }}
{{ template "header.gohtml" . }}
<div class="container">
{{ template "sidebar.gohtml" . }}
<div class="main">
<h2>Tovi Jaeschke</h2>
<p>Hello! My name is Tovi. I'm a 21 year old programmer and computer security enthusiast.</p>
<p>My main hobbies include reading, programming, pentesting, philosophy, and designing websites. I actively develop in Go, Python, php, and HTML/CSS/JS. I enjoy using versatile, minimalist, open source programs, such as vim, st, dmenu, and dwm.</p>
<p>You can find some of my portfolio and some front-end demos <a href="https://demos.tovijaeschke.xyz">here</a></p>
<p>On this site, you will find programs I have written, CTF walkthroughs, minimalist programs I have found and begun using, and updates about my current workflow.</p>
<h3>Recent posts:</h3>
<ul class="index-recent-posts">
<?php include 'php/recent-posts-index.php';?>
</ul>
{{ if eq .PageView "index-intro.gohtml" }}
{{ template "index-intro.gohtml" . }}
{{ else if eq .PageView "post-list.gohtml" }}
{{ template "post-list.gohtml" . }}
{{ else if eq .PageView "post.gohtml" }}
{{ template "post.gohtml" . }}
{{ end }}
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
<p>Last updated: {{ FormatTimestamp .LastUpdatedAt }}</p>
</footer>
</body>
</html>

+ 0
- 66
web/html/pentesting.html View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="js/prism.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<header>
<a href="/"><h2 href="/">Tovi Jaeschke</h2></a>
<div class="nav-toggle">
<div class="nav-toggle-bar"></div>
</div>
<div class="links">
<ul>
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<a href="/pentesting.html?page=0"><li class="active">Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
</ul>
</header>
<div class="container">
<div class="left-bar">
<p>Links:</p>
<ul class="expand-links">
<a href="mailto:tovi@tovijaeschke.xyz"><li>Email</li></a>
<a href="https://git.tovijaeschke.xyz"><li>Git</li></a>
<a href="https://gitlab.com/tovijaeschke"><li>Gitlab</li></a>
<a href="/static/Resume.pdf"><li>Resume</li></a>
<a href="https://demos.tovijaeschke.xyz/"><li>Portfolio</li></a>
</ul>
<p>Recent posts:</p>
<ul>
<?php include 'php/recent-posts.php';?>
</ul>
</div>
<div class="main">
<h2>Pentesting</h2>
<ul class="index-recent-posts">
<?php include 'php/recent-posts-pentest.php';?>
</ul>
<div class="paginate">
<ul>
<?php Paginate();?>
</ul>
</div>
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
</footer>
</body>
</html>

+ 0
- 66
web/html/personal.html View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="js/prism.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<header>
<a href="/"><h2 href="/">Tovi Jaeschke</h2></a>
<div class="nav-toggle">
<div class="nav-toggle-bar"></div>
</div>
<div class="links">
<ul>
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li class="active">Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
</ul>
</header>
<div class="container">
<div class="left-bar">
<p>Links:</p>
<ul class="expand-links">
<a href="mailto:tovi@tovijaeschke.xyz"><li>Email</li></a>
<a href="https://git.tovijaeschke.xyz"><li>Git</li></a>
<a href="https://gitlab.com/tovijaeschke"><li>Gitlab</li></a>
<a href="/static/Resume.pdf"><li>Resume</li></a>
<a href="https://demos.tovijaeschke.xyz/"><li>Portfolio</li></a>
</ul>
<p>Recent posts:</p>
<ul>
<?php include 'php/recent-posts.php';?>
</ul>
</div>
<div class="main">
<h2>Personal</h2>
<ul class="index-recent-posts">
<?php include 'php/recent-posts-personal.php';?>
</ul>
<div class="paginate">
<ul>
<?php Paginate();?>
</ul>
</div>
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
</footer>
</body>
</html>

+ 23
- 0
web/html/post-list.gohtml View File

@ -0,0 +1,23 @@
<h2>{{ .Subject }}</h2>
<ul class="index-recent-posts">
{{ range $post := .Posts }}
<a href="/post/{{ $post.ID }}">
<li>
<div>
<h4 class="index-recent-posts-title">{{ $post.Title }}</h4>
<p class="datetimebox">{{ FormatTimestamp $post.UpdatedAt }}</p>
</div>
</li>
</a>
{{ end }}
</ul>
<div class="paginate">
<ul>
<a href="/{{ StrToLower .Subject }}?page=0"><li>&lt;</li></a>
{{ $subj := StrToLower .Subject }}
{{ range $i := Iterate .PageCount }}
<a href="/{{ $subj }}?page={{ $i }}"><li>{{ PlusInt $i 1 }}</li></a>
{{end}}
<a href="/{{ StrToLower .Subject }}?page={{ MinusInt .PageCount 1 }}"><li>&gt;</li></a>
</ul>
</div>

+ 8
- 0
web/html/post.gohtml View File

@ -0,0 +1,8 @@
<h3 class='post-title'>{{ .Post.Title }}</h2>
{{ if .Post.MainImage }}
<div class='icon-div'>
<img class='post-icon' src='{{ .Post.MainImage }}' />
</div>
{{ end }}
{{ .Post.Intro }}
{{ .Post.Body }}

+ 0
- 80
web/html/post.html View File

@ -1,80 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/post.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="https://www.google.com/recaptcha/api.js"></script>
<script src="js/prism.js"></script>
<script src="js/code_resize.js"></script>
<script>
function onSubmit(token) {
document.getElementById("comment-form").submit();
}
</script>
</head>
<body>
<?php include 'php/post.php';?>
<header>
<a href="/"><h2 href="/">Tovi Jaeschke</h2></a>
<div class="nav-toggle">
<div class="nav-toggle-bar"></div>
</div>
<div class="links">
<ul>
<a href="/personal.html"><li>Personal</li></a>
<?php getSubject(); ?>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<?php getSubject(); ?>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
</ul>
</header>
<div class="container">
<div class="left-bar">
<p>Links:</p>
<ul class="expand-links">
<a href="mailto:tovi@tovijaeschke.xyz"><li>Email</li></a>
<a href="https://git.tovijaeschke.xyz"><li>Git</li></a>
<a href="https://gitlab.com/tovijaeschke"><li>Gitlab</li></a>
<a href="/static/Resume.pdf"><li>Resume</li></a>
<a href="https://demos.tovijaeschke.xyz/"><li>Portfolio</li></a>
</ul>
<p>Recent posts:</p>
<ul>
<?php include 'php/recent-posts.php';?>
</ul>
</div>
<div class="main">
<?php getBody(); ?>
<div class="comments">
<h3 class="comment-title">Comments</h3>
<form id="comment-form" class="comment-form" action="php/add-comment.php" method="post">
<label for="email">Name</label><br>
<input type="text" id="email" name="email" required placeholder="1337 H4X0R"><br>
<label for="comment">Comment</label><br>
<textarea id="comment" name="comment" value="comment" required placeholder="Dank meme bro"></textarea><br>
<input type="text" name="post_id" value="<?php getPostId(); ?>" style="display: none;">
<button class="g-recaptcha"
data-sitekey="6Lf30cQZAAAAAKb9cV9A_q0v4tP_hQkLFA0hs_dS"
data-callback='onSubmit'
data-action='submit'
type="submit">Submit</button>
</form>
<?php include 'php/comments.php';?>
</div>
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
</footer>
</body>
</html>

+ 0
- 66
web/html/programming.html View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Tovi Jaeschke's Homepage</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
<link href='https://fonts.googleapis.com/css?family=Average|Montserrat' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/prism.css">
<script src="js/prism.js"></script>
<script src="js/script.js"></script>
</head>
<body>
<header>
<a href="/"><h2 href="/">Tovi Jaeschke</h2></a>
<div class="nav-toggle">
<div class="nav-toggle-bar"></div>
</div>
<div class="links">
<ul>
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li>Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
<a href="/links.html"><li>Links</li></a>
</ul>
</div>
<ul class="pc-links">
<a href="/pentesting.html?page=0"><li>Pentesting</li></a>
<a href="/programming.html?page=0"><li class="active">Programming</li></a>
<a href="/personal.html"><li>Personal</li></a>
<a href="/hireme.html"><li>Hire Me</li></a>
</ul>
</header>
<div class="container">
<div class="left-bar">
<p>Links:</p>
<ul class="expand-links">
<a href="mailto:tovi@tovijaeschke.xyz"><li>Email</li></a>
<a href="https://git.tovijaeschke.xyz"><li>Git</li></a>
<a href="https://gitlab.com/tovijaeschke"><li>Gitlab</li></a>
<a href="/static/Resume.pdf"><li>Resume</li></a>
<a href="https://demos.tovijaeschke.xyz/"><li>Portfolio</li></a>
</ul>
<p>Recent posts:</p>
<ul>
<?php include 'php/recent-posts.php';?>
</ul>
</div>
<div class="main">
<h2>Programming</h2>
<ul class="index-recent-posts">
<?php include 'php/recent-posts-programming.php';?>
</ul>
<div class="paginate">
<ul>
<?php Paginate();?>
</ul>
</div>
</div>
</div>
<footer>
<a href="mailto:tovi@tovijaeschke.xyz">tovi@tovijaeschke.xyz</a>
<p>Last updated: <?php lastUpdate();?></p>
</footer>
</body>
</html>

+ 37
- 0
web/js/code_resize.js View File

@ -0,0 +1,37 @@
var code_resize = function() {
var sheet = window.document.styleSheets[0];
var leftbar = document.querySelector('.left-bar');
var style = getComputedStyle(leftbar).getPropertyValue('display');
if (style == "none") {
var width = screen.width - 180;
} else {
var width = screen.width - 460;
}
sheet.insertRule('pre { max-width: ' + width + 'px; }', sheet.cssRules.length);
sheet.insertRule('.command-line { max-width: ' + (width + 50) + 'px; }', sheet.cssRules.length);
}
window.onload = function() {
code_resize();
window.onresize = code_resize;
(function() {
var hamburger = {
navToggle: document.querySelector('.nav-toggle'),
nav: document.querySelector('.links'),
doToggle: function(e) {
e.preventDefault();
this.navToggle.classList.toggle('expanded');
this.nav.classList.toggle('expanded');
}
};
document.addEventListener('click', function(e) {
if (e.target.className.includes("nav-toggle")) {
hamburger.doToggle(e);
} else {
hamburger.navToggle.classList.remove('expanded');
hamburger.nav.classList.remove('expanded');
}
});
}());
}

+ 174
- 0
web/js/prism.js
File diff suppressed because it is too large
View File


+ 22
- 0
web/js/script.js View File

@ -0,0 +1,22 @@
window.onload = function() {
(function() {
var hamburger = {
navToggle: document.querySelector('.nav-toggle'),
nav: document.querySelector('.links'),
doToggle: function(e) {
e.preventDefault();
this.navToggle.classList.toggle('expanded');
this.nav.classList.toggle('expanded');
}
};
document.addEventListener('click', function(e) {
if (e.target.className.includes("nav-toggle")) {
hamburger.doToggle(e);
} else {
hamburger.navToggle.classList.remove('expanded');
hamburger.nav.classList.remove('expanded');
}
});
}());
}

Loading…
Cancel
Save