-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 928a292
Showing
11 changed files
with
440 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
# See the following link for documentation: | ||
# https://github.com/marketplace/actions/dokku | ||
- name: Push to medusa | ||
uses: dokku/[email protected] | ||
with: | ||
ssh_private_key: ${{ secrets.MEDUSA_GLOBAL_DEPLOY_KEY }} | ||
git_remote_url: ssh://[email protected]/aaaallltt | ||
# force might feel risky, but there is no good reason why the server | ||
# should ever not be a mirror of the deploy branch. And the errors we | ||
# could get otherwise would probably be nasty to deal with | ||
git_push_flags: --force |
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 @@ | ||
FROM golang:1.22-alpine3.19 AS build | ||
|
||
COPY . . | ||
|
||
RUN go build -o /aaaallltt | ||
|
||
FROM alpine:3.19 | ||
|
||
COPY --from=build /aaaallltt /aaaallltt | ||
|
||
CMD ["/aaaallltt"] |
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 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Konglig Datasektionen | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,3 @@ | ||
module github.com/datasektionen/aaaallltt | ||
|
||
go 1.22.1 |
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,62 @@ | ||
<!DOCTYPE html> | ||
<html lang="sv"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Aaaallltt</title> | ||
<link rel="stylesheet" href="/index.css" lang="text/css"> | ||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.0/css/all.css" lang="text/css"> | ||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lato:400,300,700,400italic,700italic,900" lang="text/css"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="96x96" href="/favicon-96x96.png"> | ||
</head> | ||
<body> | ||
<div id="methone-container-replace"></div> | ||
<script> | ||
window.methone_conf = { | ||
system_name: "Aaaallltt", | ||
color_scheme: "orange", | ||
} | ||
</script> | ||
<script src="https://methone.datasektionen.se/bar.js"></script> | ||
<header> | ||
<div> | ||
<h1>Hoppsan, det där systemet fanns tydligen inte!</h1> | ||
</div> | ||
</header> | ||
<main> | ||
<p> | ||
Du har gått in på ett system som inte (längre?) finns. Det är jättesynd. Så synd att vi | ||
skulle vilja gräva upp det begravda Bawangmonstret för att glömma sorgen. | ||
</p> | ||
<h2>Andra system</h2> | ||
<p>Du kanske letade efter något av dessa system?</p> | ||
{{ range . }} | ||
<p> | ||
<img style="{{ .IconStyle }}" src="{{ .Icon }}"> <a href="{{ .URL }}" style="color: {{ .Color }}">{{ .Name }}</a> - <span>{{ .Description }}</span> | ||
</p> | ||
{{ end }} | ||
<h2>Bygg ett nytt system på den här domänen!</h2> | ||
<p> | ||
Har du en idé om vad som skulle kunna finnas på den här sidan? Kom då till någon av | ||
Informationsorganets hackerkvällar! Där kan vi berätta lite om hur man kan gå tillväga | ||
och integrerar med våra andra system och till och med erbjuda hjälp på traven. | ||
</p> | ||
<p> | ||
Hackerkvällarna äger rum på torsdagar oftast i någon sal i E-huset. Exakt när och var | ||
bör annonseras på <a href="https://datasektionen.se/nyheter">sektionens webbsida</a>, | ||
men du kan också fråga Systemansvarig på <a href="[email protected]">epost</a>, | ||
eller kolla upp vem det är på | ||
<a href="https://dfunkt.datasektionen.se/position/id/40">dfunkt</a> och fråga denne på | ||
till exempel Discord. | ||
</p> | ||
</main> | ||
<footer> | ||
<p> | ||
Vänliga hälsningar, <br> | ||
<strong>Informationsorganet</strong> | ||
</p> | ||
</footer> | ||
</body> | ||
</html> |
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,77 @@ | ||
package main | ||
|
||
import ( | ||
"embed" | ||
"encoding/json" | ||
"html/template" | ||
"io/fs" | ||
"log/slog" | ||
"net/http" | ||
"os" | ||
) | ||
|
||
type system struct { | ||
Name string | ||
Description string | ||
URL string | ||
Color string | ||
Icon string | ||
IconStyle template.CSS | ||
Sensitive bool | ||
} | ||
|
||
//go:embed static/* | ||
var assets embed.FS | ||
|
||
//go:embed index.html | ||
var indexFile string | ||
|
||
func main() { | ||
darkmodeURL, ok := os.LookupEnv("DARKMODE_URL") | ||
if !ok { | ||
darkmodeURL = "https://darkmode.datasektionen.se/" | ||
} | ||
|
||
indexTemplate, err := template.New("index.html").Parse(indexFile) | ||
if err != nil { | ||
panic(err) | ||
} | ||
http.HandleFunc("/{$}", func(w http.ResponseWriter, r *http.Request) { | ||
res, err := http.Get(darkmodeURL) | ||
if err != nil { | ||
http.Error(w, "Internal server error", http.StatusInternalServerError) | ||
slog.Error("Failed fetching darkmode status", "error", err) | ||
} | ||
var darkmode bool | ||
if err := json.NewDecoder(res.Body).Decode(&darkmode); err != nil { | ||
http.Error(w, "Internal server error", http.StatusInternalServerError) | ||
slog.Error("Failed parsing darkmode status", "error", err) | ||
} | ||
systemsToShow := systems | ||
if darkmode { | ||
systemsToShow = make([]system, 0, len(systems)) | ||
for _, system := range systems { | ||
if !system.Sensitive { | ||
systemsToShow = append(systemsToShow, system) | ||
} | ||
} | ||
} | ||
if err := indexTemplate.Execute(w, systemsToShow); err != nil { | ||
http.Error(w, "Failed rendering template", http.StatusInternalServerError) | ||
slog.Error("Failed rendering template", "error", err) | ||
} | ||
}) | ||
|
||
fs, err := fs.Sub(assets, "static") | ||
if err != nil { | ||
panic(err) | ||
} | ||
http.Handle("/", http.FileServer(http.FS(fs))) | ||
|
||
port, ok := os.LookupEnv("PORT") | ||
if !ok { | ||
port = "3000" | ||
} | ||
slog.Info("Started", "port", port) | ||
http.ListenAndServe(":"+port, nil) | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,71 @@ | ||
* { | ||
padding: 0; | ||
margin: 0; | ||
box-sizing: border-box; | ||
} | ||
|
||
body { | ||
font-family: Lato, sans-serif; | ||
padding-top: 50px; | ||
background-color: #fafafa; | ||
font-size: 16px; | ||
} | ||
|
||
header { | ||
background-color: #ffa726; | ||
color: white; | ||
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.2); | ||
position: relative; | ||
z-index: 1; | ||
} | ||
|
||
header div { | ||
max-width: 1240px; | ||
text-align: center; | ||
margin-inline: auto; | ||
} | ||
|
||
header h1 { | ||
padding: 20px 20%; | ||
font-size: 2.6rem; | ||
} | ||
|
||
main { | ||
background-color: white; | ||
max-width: 1240px; | ||
margin-inline: auto; | ||
padding: 3rem; | ||
color: #757575; | ||
} | ||
|
||
main p { | ||
padding-block-end: 1em; | ||
} | ||
|
||
main h2 { | ||
padding-block-end: 0.4em; | ||
} | ||
|
||
main img { | ||
height: 2rem; | ||
width: 2rem; | ||
vertical-align: middle; | ||
} | ||
|
||
a { | ||
color: #ff9800; | ||
} | ||
|
||
footer { | ||
max-width: 1240px; | ||
background-color: #333; | ||
margin-inline: auto; | ||
margin-block-start: 2rem; | ||
padding: 3rem; | ||
color: #aaa; | ||
text-align: center; | ||
} | ||
|
||
footer strong { | ||
color: white; | ||
} |
Oops, something went wrong.