diff --git a/.gitignore b/.gitignore index 6eecba4..913e327 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ **/.DS_Store .idea/ tmp/ +test/ diff --git a/api/api.go b/api/api.go index 5a26185..ebe0326 100644 --- a/api/api.go +++ b/api/api.go @@ -1,20 +1,12 @@ package api import ( - "net/http" - "html/template" - - "arimelody.me/arimelody.me/api/v1/admin" + "net/http" + "html/template" ) func Handle(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - code := 404; - if req.URL.Path == "/api/v1/admin/login" { - code = admin.HandleLogin(writer, req, root) - } - - if code == 404 { - writer.Write([]byte("404 not found")) - } - return code; + writer.WriteHeader(501) + writer.Write([]byte("501 Not Implemented")) + return 501; } diff --git a/api/v1/admin/admin.go b/api/v1/admin/admin.go index 5a1963c..5132dcc 100644 --- a/api/v1/admin/admin.go +++ b/api/v1/admin/admin.go @@ -1,43 +1,228 @@ package admin import ( + "context" + "encoding/json" "fmt" - "html/template" - "io" + "math/rand" "net/http" + "net/url" + "os" + "strings" + "time" + + "arimelody.me/arimelody.me/discord" ) type ( - State struct { - Token string - } + Session struct { + UserID string + Token string + } + + loginData struct { + UserID string + Password string + } ) -func CreateState() *State { - return &State{ - Token: "you are the WINRAR!!", - } +const TOKEN_LENGTH = 64 +const TOKEN_CHARS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" + +// TODO: consider relying *entirely* on env vars instead of hard-coded fallbacks +var ADMIN_ID_DISCORD = func() string { + envvar := os.Getenv("DISCORD_ADMIN_ID") + if envvar != "" { + return envvar + } else { + return "356210742200107009" + } +}() + +var sessions []*Session + +func CreateSession(UserID string) Session { + return Session{ + UserID: UserID, + Token: string(generateToken()), + } } -func HandleLogin(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - if req.Method != "POST" { - return 404; +func Handler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + fmt.Println(r.URL.Path) + + w.WriteHeader(200) + w.Write([]byte("hello admin!")) + }) +} + +func AuthorisedHandler(next http.Handler) http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + auth := r.Header.Get("Authorization") + if auth == "" || !strings.HasPrefix(auth, "Bearer ") { + cookie, err := r.Cookie("token") + if err != nil { + w.WriteHeader(401) + w.Write([]byte("Unauthorized")) + return + } + auth = cookie.Value + } + auth = auth[7:] + + var session *Session + for _, s := range sessions { + if s.Token == auth { + session = s + break + } + } + + if session == nil { + w.WriteHeader(401) + w.Write([]byte("Unauthorized")) + return } - body, err := io.ReadAll(req.Body) + ctx := context.WithValue(r.Context(), "token", session.Token) + next.ServeHTTP(w, r.WithContext(ctx)) + }) +} + +func LoginHandler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + code := r.URL.Query().Get("code") + + if code == "" { + w.Header().Add("Location", discord.REDIRECT_URI) + w.WriteHeader(307) + return + } + + // let's get an oauth token! + req, err := http.NewRequest(http.MethodPost, fmt.Sprintf("%s/oauth2/token", discord.API_ENDPOINT), + strings.NewReader(url.Values{ + "client_id": {discord.CLIENT_ID}, + "client_secret": {discord.CLIENT_SECRET}, + "grant_type": {"authorization_code"}, + "code": {code}, + "redirect_uri": {discord.MY_REDIRECT_URI}, + }.Encode())) + req.Header.Add("Content-Type", "application/x-www-form-urlencoded") + + res, err := http.DefaultClient.Do(req) if err != nil { - fmt.Printf("failed to parse request body!\n"); - return 500; + fmt.Printf("Failed to retrieve OAuth token: %s\n", err) + w.WriteHeader(500) + w.Write([]byte("Internal server error")) + return } - if string(body) != "super epic mega gaming password" { - return 400; + oauth := discord.AccessTokenResponse{} + + err = json.NewDecoder(res.Body).Decode(&oauth) + if err != nil { + fmt.Printf("Failed to parse OAuth response data from discord: %s\n", err) + w.WriteHeader(500) + w.Write([]byte("Internal server error")) + return + } + res.Body.Close() + + discord_access_token := oauth.AccessToken + + // let's get authorisation information! + req, err = http.NewRequest(http.MethodGet, fmt.Sprintf("%s/oauth2/@me", discord.API_ENDPOINT), nil) + req.Header.Add("Authorization", "Bearer " + discord_access_token) + + res, err = http.DefaultClient.Do(req) + if err != nil { + fmt.Printf("Failed to retrieve discord auth information: %s\n", err) + w.WriteHeader(500) + w.Write([]byte("Internal server error")) + return } - state := CreateState(); + auth_info := discord.AuthInfoResponse{} - writer.WriteHeader(200); - writer.Write([]byte(state.Token)) + err = json.NewDecoder(res.Body).Decode(&auth_info) + if err != nil { + fmt.Printf("Failed to parse auth information from discord: %s\n", err) + w.WriteHeader(500) + w.Write([]byte("Internal server error")) + return + } + res.Body.Close() - return 200; + discord_user_id := auth_info.User.Id + + if discord_user_id != ADMIN_ID_DISCORD { + // TODO: unauthorized user. revoke the token + w.WriteHeader(401) + w.Write([]byte("Unauthorized")) + return + } + + // login success! + session := CreateSession(auth_info.User.Username) + sessions = append(sessions, &session) + + cookie := http.Cookie{} + cookie.Name = "token" + cookie.Value = session.Token + cookie.Expires = time.Now().Add(24 * time.Hour) + // cookie.Secure = true + cookie.HttpOnly = true + cookie.Path = "/" + http.SetCookie(w, &cookie) + + w.WriteHeader(200) + w.Write([]byte(session.Token)) + }) +} + +func LogoutHandler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + token := r.Context().Value("token").(string) + + if token == "" { + w.WriteHeader(401) + return + } + + // remove this session from the list + sessions = func (token string) []*Session { + new_sessions := []*Session{} + for _, session := range sessions { + new_sessions = append(new_sessions, session) + } + return new_sessions + }(token) + + w.WriteHeader(200) + }) +} + +func OAuthCallbackHandler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + }) +} + +func VerifyHandler() http.Handler { + return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // this is an authorised endpoint, so you *must* supply a valid token + // before accessing this route. + w.WriteHeader(200) + }) +} + +func generateToken() string { + var token []byte + + for i := 0; i < TOKEN_LENGTH; i++ { + token = append(token, TOKEN_CHARS[rand.Intn(len(TOKEN_CHARS))]) + } + + return string(token) } diff --git a/api/v1/music/music.go b/api/v1/music/music.go index 6e85be5..9a94670 100644 --- a/api/v1/music/music.go +++ b/api/v1/music/music.go @@ -1,33 +1,37 @@ package music import ( - "fmt" - "time" + "errors" + "fmt" + "time" ) +var Releases []*MusicRelease; +var Artists []*Artist; + func make_date_work(date string) time.Time { - res, err := time.Parse("2-Jan-2006", date) - if err != nil { - fmt.Printf("somehow we failed to parse %s! falling back to epoch :]\n", date) - return time.Unix(0, 0) + res, err := time.Parse("2-Jan-2006", date) + if err != nil { + fmt.Printf("somehow we failed to parse %s! falling back to epoch :]\n", date) + return time.Unix(0, 0) + } + return res +} + +func GetRelease(id string) (*MusicRelease, error) { + for _, release := range Releases { + if release.Id == id { + return release, nil } - return res + } + return nil, errors.New(fmt.Sprintf("Release %s not found", id)) } -func GetRelease(id string) (MusicRelease, bool) { - for _, album := range placeholders { - if album.Id == id { - return album, true - } +func GetArtist(id string) (*Artist, error) { + for _, artist := range Artists { + if artist.Id == id { + return artist, nil } - return MusicRelease{}, false + } + return nil, errors.New(fmt.Sprintf("Artist %s not found", id)) } - -func QueryAllMusic() ([]MusicRelease) { - return placeholders -} - -func QueryAllArtists() ([]Artist) { - return []Artist{ ari, mellodoot, zaire, mae, loudar, red } -} - diff --git a/api/v1/music/music_placeholders.go b/api/v1/music/music_placeholders.go deleted file mode 100644 index 96b1f61..0000000 --- a/api/v1/music/music_placeholders.go +++ /dev/null @@ -1,161 +0,0 @@ -package music - -var ari = Artist{ - Id: "arimelody", - Name: "ari melody", - Website: "https://arimelody.me", -} -var mellodoot = Artist{ - Id: "mellodoot", - Name: "mellodoot", - Website: "https://mellodoot.com", -} -var zaire = Artist{ - Id: "zaire", - Name: "zaire", - Website: "https://supitszaire.com", -} -var mae = Artist{ - Id: "maetaylor", - Name: "mae taylor", - Website: "https://mae.wtf", -} -var loudar = Artist{ - Id: "loudar", - Name: "Loudar", - Website: "https://alex.targoninc.com", -} -var red = Artist { - Id: "smoljorb", - Name: "smoljorb", -} - -var placeholders = []MusicRelease{ - { - Id: "test", - Title: "test album", - Type: "album", - ReleaseDate: make_date_work("18-Mar-2024"), - Buyname: "go get it!!", - Buylink: "https://arimelody.me/", - Links: []MusicLink{ - { - Name: "youtube", - Url: "https://youtu.be/dQw4w9WgXcQ", - }, - }, - Description: - `Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas viverra ligula interdum, tempor metus venenatis, tempus est. Praesent semper vulputate nulla, a venenatis libero elementum id. Proin maximus aliquet accumsan. Integer eu orci congue, ultrices leo sed, maximus risus. Integer laoreet non urna non accumsan. Cras ut sollicitudin justo. Vivamus eu orci tempus, aliquet est rhoncus, tempus neque. Aliquam tempor sit amet nibh sed tempus. Nulla vitae bibendum purus. Sed in mi enim. Nam pharetra enim lorem, vel tristique diam malesuada a. Duis dignissim nunc mi, id semper ex tincidunt a. Sed laoreet consequat lacus a consectetur. Nulla est diam, tempus eget lacus ullamcorper, tincidunt faucibus ex. Duis consectetur felis sit amet ante fermentum interdum. Sed pulvinar laoreet tellus.`, - Credits: []MusicCredit{ - { - Artist: &ari, - Role: "having the swag", - }, - { - Artist: &zaire, - Role: "having the swag", - }, - { - Artist: &mae, - Role: "having the swag", - }, - { - Artist: &loudar, - Role: "having the swag", - }, - }, - Tracks: []MusicTrack{ - { - Number: 0, - Title: "track 1", - Description: "sample track description", - Lyrics: "sample lyrics for track 1!", - PreviewUrl: "https://mellodoot.com/audio/preview/dream.webm", - }, - { - Number: 1, - Title: "track 2", - Description: "sample track description", - Lyrics: "sample lyrics for track 2!", - PreviewUrl: "https://mellodoot.com/audio/preview/dream.webm", - }, - }, - }, - { - Id: "dream", - Title: "Dream", - Type: "single", - ReleaseDate: make_date_work("11-Nov-2022"), - Artwork: "https://mellodoot.com/img/music_artwork/mellodoot_-_Dream.webp", - Buylink: "https://arimelody.bandcamp.com/track/dream", - Links: []MusicLink{ - { - Name: "spotify", - Url: "https://open.spotify.com/album/5talRpqzjExP1w6j5LFIAh", - }, - { - Name: "apple music", - Url: "https://music.apple.com/ie/album/dream-single/1650037132", - }, - { - Name: "soundcloud", - Url: "https://soundcloud.com/arimelody/dream2022", - }, - { - Name: "youtube", - Url: "https://www.youtube.com/watch?v=nfFgtMuYAx8", - }, - }, - Description: "living the dream 🌌 ✨", - Credits: []MusicCredit{ - { - Artist: &mellodoot, - Role: "vocals", - }, - { - Artist: &mellodoot, - Role: "production", - }, - { - Artist: &mellodoot, - Role: "artwork", - }, - }, - Tracks: []MusicTrack{ - { - Number: 0, - Title: "Dream", - Description: "no description here!", - Lyrics: - `the truth is what you make of it - in the end, what you spend, is the end of it - when you're lost in the life - the life that you created on your own - i'm becoming one - with the soul that i see in the mirror - blending one and whole - this time, i'm real - - i'm living the dream - i'm living my best life - running out of time - i gotta make this right - whenever you rise - whenever you come down - fall away from the light - and then fall into our arms - - the truth is what you make of it - in the end, what you spend, is the end of it - when you're lost in the life - the life that you created on your own - i'm becoming one - with the soul that i see in the mirror - blending one and whole - this time, i'm real`, - PreviewUrl: "https://mellodoot.com/audio/preview/dream.webm", - }, - }, - }, -} - diff --git a/api/v1/music/music_types.go b/api/v1/music/music_types.go index 72677d9..e2260a0 100644 --- a/api/v1/music/music_types.go +++ b/api/v1/music/music_types.go @@ -1,136 +1,133 @@ package music import ( - "regexp" - "strings" - "time" + "regexp" + "strings" + "time" ) type ( - Artist struct { - Id string - Name string - Website string - } + Artist struct { + Id string + Name string + Website string + } - MusicRelease struct { - Id string - Title string - Type string - ReleaseDate time.Time - Artwork string - Buyname string - Buylink string - Links []MusicLink - Description string - Credits []MusicCredit - Tracks []MusicTrack - } + MusicRelease struct { + Id string + Title string + Type string + ReleaseDate time.Time + Artwork string + Buyname string + Buylink string + Links []MusicLink + Description string + Credits []MusicCredit + Tracks []MusicTrack + } - MusicLink struct { - Name string - Url string - } + MusicLink struct { + Name string + Url string + } - MusicCredit struct { - Artist *Artist - Role string - Meta bool // for "meta" contributors (i.e. not credited for the musical work, but other related assets) - } + MusicCredit struct { + Artist *Artist + Role string + Primary bool + } - MusicTrack struct { - Number int - Title string - Description string - Lyrics string - PreviewUrl string - } + MusicTrack struct { + Number int + Title string + Description string + Lyrics string + PreviewUrl string + } ) -func (release MusicRelease) GetUniqueArtists(include_meta bool) []*Artist { - res := []*Artist{} - for _, credit := range release.Credits { - if !include_meta && credit.Meta { - continue - } - - exists := false - for _, a := range res { - if a == credit.Artist { - exists = true - break - } - } - if exists { - continue - } - - res = append(res, credit.Artist) +func (release MusicRelease) GetUniqueArtists(include_non_primary bool) []*Artist { + res := []*Artist{} + for _, credit := range release.Credits { + if !include_non_primary && !credit.Primary { + continue } - // now create the actual array to send - return res + exists := false + for _, a := range res { + if a == credit.Artist { + exists = true + break + } + } + if exists { + continue + } + + res = append(res, credit.Artist) + } + + return res } -func (release MusicRelease) GetUniqueArtistNames(include_meta bool) []string { - artists := release.GetUniqueArtists(include_meta) - names := []string{} - for _, artist := range artists { - names = append(names, artist.Name) - } +func (release MusicRelease) GetUniqueArtistNames(include_non_primary bool) []string { + artists := release.GetUniqueArtists(include_non_primary) + names := []string{} + for _, artist := range artists { + names = append(names, artist.Name) + } - return names + return names } -func (album MusicRelease) PrintPrimaryArtists(include_meta bool) string { - names := album.GetUniqueArtistNames(include_meta) - if len(names) == 1 { - return names[0] - } +func (release MusicRelease) PrintPrimaryArtists(include_non_primary bool, ampersand bool) string { + names := release.GetUniqueArtistNames(include_non_primary) + if len(names) == 0 { + return "Unknown Artist" + } else if len(names) == 1 { + return names[0] + } + if ampersand { res := strings.Join(names[:len(names)-1], ", ") res += " & " + names[len(names)-1] return res -} - -func (album MusicRelease) PrintCommaPrimaryArtists(include_meta bool) string { - names := album.GetUniqueArtistNames(include_meta) - if len(names) == 1 { - return names[0] - } + } else { return strings.Join(names[:], ", ") + } } -func (album MusicRelease) ResolveType() string { - if album.Type != "" { - return album.Type - } - return "unknown" +func (release MusicRelease) ResolveType() string { + if release.Type != "" { + return release.Type + } + return "unknown" } -func (album MusicRelease) ResolveArtwork() string { - if album.Artwork != "" { - return album.Artwork - } - return "/img/music-artwork/default.png" +func (release MusicRelease) ResolveArtwork() string { + if release.Artwork != "" { + return release.Artwork + } + return "/img/music-artwork/default.png" } -func (album MusicRelease) PrintReleaseDate() string { - return album.ReleaseDate.Format("02 January 2006") +func (release MusicRelease) PrintReleaseDate() string { + return release.ReleaseDate.Format("02 January 2006") } -func (album MusicRelease) GetReleaseYear() int { - return album.ReleaseDate.Year() +func (release MusicRelease) GetReleaseYear() int { + return release.ReleaseDate.Year() } func (link MusicLink) NormaliseName() string { - re := regexp.MustCompile(`[^a-z0-9]`) - return strings.ToLower(re.ReplaceAllString(link.Name, "")) + re := regexp.MustCompile(`[^a-z0-9]`) + return strings.ToLower(re.ReplaceAllString(link.Name, "")) } func (release MusicRelease) IsSingle() bool { - return len(release.Tracks) == 1; + return len(release.Tracks) == 1; } func (credit MusicCredit) ResolveArtist() Artist { - return *credit.Artist + return *credit.Artist } diff --git a/db.go b/db.go index 5ae0e43..117e3e6 100644 --- a/db.go +++ b/db.go @@ -1,72 +1,61 @@ package main import ( - "arimelody.me/arimelody.me/api/v1/music" + "arimelody.me/arimelody.me/api/v1/music" - "fmt" - "os" - "time" + "fmt" + "os" + "time" - _ "github.com/lib/pq" - "github.com/jmoiron/sqlx" + "github.com/jmoiron/sqlx" + _ "github.com/lib/pq" ) -var schema = -`CREATE TABLE IF NOT EXISTS artists ( - id TEXT PRIMARY KEY, - name TEXT, - website TEXT -); - -CREATE TABLE IF NOT EXISTS musicreleases ( - id VARCHAR(64) PRIMARY KEY, - title TEXT NOT NULL, - type TEXT, - release_date DATE NOT NULL, - artwork TEXT, - buyname TEXT, - buylink TEXT -); - -CREATE TABLE IF NOT EXISTS musiclinks ( - release VARCHAR(64) REFERENCES musicreleases(id) ON DELETE CASCADE ON UPDATE CASCADE, - name TEXT, - url TEXT, - CONSTRAINT musiclinks_pk PRIMARY KEY (release, name) -); - -CREATE TABLE IF NOT EXISTS musiccredits ( - release VARCHAR(64) REFERENCES musicreleases(ID) ON DELETE CASCADE, - artist TEXT REFERENCES artists(id) ON DELETE CASCADE, - role TEXT, - meta BOOLEAN, - constraint musiccredits_pk PRIMARY KEY (release, artist) -); - -CREATE TABLE IF NOT EXISTS musictracks ( - release VARCHAR(64) REFERENCES musicreleases(ID) ON DELETE CASCADE, - number INT NOT NULL, - title TEXT NOT NULL, - description TEXT, - lyrics TEXT, - preview_url TEXT, - CONSTRAINT musictracks_pk PRIMARY KEY (release, number) -);` - func PushArtist(db *sqlx.DB, artist music.Artist) { - fmt.Printf("syncing artist [%s] to database...", artist.Name) + fmt.Printf("pushing artist [%s] to database...", artist.Name) - db.MustExec("INSERT INTO artists (id, name, website) VALUES ($1, $2, $3) ON CONFLICT (id) DO UPDATE SET name=$2, website=$3", + db.MustExec("INSERT INTO artists (id, name, website) VALUES ($1, $2, $3) ON CONFLICT (id) DO UPDATE SET name=$2, website=$3", &artist.Id, &artist.Name, &artist.Website, -) + ) -fmt.Printf("done!\n") + fmt.Printf("done!\n") +} + +func PullAllArtists(db *sqlx.DB) ([]*music.Artist, error) { + artists := []*music.Artist{} + + rows, err := db.Query("SELECT id, name, website FROM artists") + if err != nil { + return nil, err + } + + for rows.Next() { + var artist = music.Artist{} + err = rows.Scan(&artist.Id, &artist.Name, &artist.Website) + if err != nil { + return nil, err + } + artists = append(artists, &artist) + } + + return artists, nil +} + +func PullArtist(db *sqlx.DB, artistID string) (music.Artist, error) { + artist := music.Artist{} + + err := db.Get(&artist, "SELECT id, name, website FROM artists WHERE id=$1", artistID) + if err != nil { + return music.Artist{}, err + } + + return artist, nil } func PushRelease(db *sqlx.DB, release music.MusicRelease) { - fmt.Printf("syncing release [%s] to database...", release.Id) + fmt.Printf("pushing release [%s] to database...", release.Id) tx := db.MustBegin() tx.MustExec("INSERT INTO musicreleases (id, title, type, release_date, artwork, buyname, buylink) VALUES ($1, $2, $3, $4, $5, $6, $7) "+ @@ -78,8 +67,8 @@ func PushRelease(db *sqlx.DB, release music.MusicRelease) { &release.Id, &link.Name, &link.Url) } for _, credit := range release.Credits { - tx.MustExec("INSERT INTO musiccredits (release, artist, role, meta) VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING", - &release.Id, &credit.Artist.Id, &credit.Role, &credit.Meta) + tx.MustExec("INSERT INTO musiccredits (release, artist, role, is_primary) VALUES ($1, $2, $3, $4) ON CONFLICT DO NOTHING", + &release.Id, &credit.Artist.Id, &credit.Role, &credit.Primary) } for _, track := range release.Tracks { tx.MustExec("INSERT INTO musictracks (release, number, title, description, lyrics, preview_url) VALUES ($1, $2, $3, $4, $5, $6) "+ @@ -92,6 +81,114 @@ func PushRelease(db *sqlx.DB, release music.MusicRelease) { fmt.Printf("done!\n") } +func PullAllReleases(db *sqlx.DB) ([]*music.MusicRelease, error) { + releases := []*music.MusicRelease{} + + rows, err := db.Query("SELECT id, title, type, release_date, artwork, buyname, buylink FROM musicreleases") + if err != nil { + return nil, err + } + + for rows.Next() { + var release = music.MusicRelease{} + release.Credits = []music.MusicCredit{} + release.Links = []music.MusicLink{} + release.Tracks = []music.MusicTrack{} + + err = rows.Scan( + &release.Id, + &release.Title, + &release.Type, + &release.ReleaseDate, + &release.Artwork, + &release.Buyname, + &release.Buylink) + if err != nil { + continue + } + + // pull musiccredits for artist data + credit_rows, err := db.Query("SELECT artist, role, is_primary FROM musiccredits WHERE release=$1", release.Id) + if err != nil { + fmt.Printf("error pulling credits for %s: %v\n", release.Id, err) + continue + } + for credit_rows.Next() { + var artistID string + var credit = music.MusicCredit{} + err = credit_rows.Scan( + &artistID, + &credit.Role, + &credit.Primary) + if err != nil { + fmt.Printf("error pulling credit for %s: %v\n", release.Id, err) + continue + } + artist, err := music.GetArtist(artistID) + if err != nil { + fmt.Printf("error pulling credit for %s: %v\n", release.Id, err) + continue + } + credit.Artist = artist + release.Credits = append(release.Credits, credit) + } + + // pull musiclinks for link data + link_rows, err := db.Query("SELECT name, url FROM musiclinks WHERE release=$1", release.Id); + if err != nil { + fmt.Printf("error pulling links for %s: %v\n", release.Id, err) + continue + } + for link_rows.Next() { + var link = music.MusicLink{} + err = link_rows.Scan( + &link.Name, + &link.Url) + if err != nil { + fmt.Printf("error pulling link for %s: %v\n", release.Id, err) + continue + } + release.Links = append(release.Links, link) + } + + // pull musictracks for track data + track_rows, err := db.Query("SELECT number, title, description, lyrics, preview_url FROM musictracks WHERE release=$1", release.Id); + if err != nil { + fmt.Printf("error pulling tracks for %s: %v\n", release.Id, err) + continue + } + for track_rows.Next() { + var track = music.MusicTrack{} + err = track_rows.Scan( + &track.Number, + &track.Title, + &track.Description, + &track.Lyrics, + &track.PreviewUrl) + if err != nil { + fmt.Printf("error pulling track for %s: %v\n", release.Id, err) + continue + } + release.Tracks = append(release.Tracks, track) + } + + releases = append(releases, &release) + } + + return releases, nil +} + +func PullRelease(db *sqlx.DB, releaseID string) (music.MusicRelease, error) { + release := music.MusicRelease{} + + err := db.Get(&release, "SELECT id, title, type, release_date, artwork, buyname, buylink FROM musicreleases WHERE id=$1", releaseID) + if err != nil { + return music.MusicRelease{}, err + } + + return release, nil +} + func InitDatabase() *sqlx.DB { db, err := sqlx.Connect("postgres", "user=arimelody dbname=arimelody password=fuckingpassword sslmode=disable") if err != nil { @@ -103,8 +200,5 @@ func InitDatabase() *sqlx.DB { db.SetMaxOpenConns(10) db.SetMaxIdleConns(10) - db.MustExec(schema) - fmt.Printf("database schema synchronised.\n") - return db } diff --git a/discord/discord.go b/discord/discord.go new file mode 100644 index 0000000..d6a6468 --- /dev/null +++ b/discord/discord.go @@ -0,0 +1,44 @@ +package discord + +const API_ENDPOINT = "https://discord.com/api/v10" +const CLIENT_ID = "1268013769578119208" +// TODO: good GOD change this later please i beg you. we've already broken +// the rules by doing this at all +const CLIENT_SECRET = "JUEZnixhN7BxmLIHmbECiKETMP85VT0E" +const REDIRECT_URI = "https://discord.com/oauth2/authorize?client_id=1268013769578119208&response_type=code&redirect_uri=http%3A%2F%2F127.0.0.1%3A8080%2Fapi%2Fv1%2Fadmin%2Flogin&scope=identify" +// TODO: change before prod +const MY_REDIRECT_URI = "http://127.0.0.1:8080/api/v1/admin/login" + +type ( + AccessTokenResponse struct { + TokenType string `json:"token_type"` + AccessToken string `json:"access_token"` + ExpiresIn int `json:"expires_in"` + RefreshToken string `json:"refresh_token"` + Scope string `json:"scope"` + } + + AuthInfoResponse struct { + Application struct { + Id string + Name string + Icon string + Description string + Hook bool + BotPublic bool + botRequireCodeGrant bool + VerifyKey bool + } + Scopes []string + Expires string + User struct { + Id string + Username string + Avatar string + Discriminator string + GlobalName string + PublicFlags int + } + } +) + diff --git a/global/global.go b/global/global.go new file mode 100644 index 0000000..bfc9db8 --- /dev/null +++ b/global/global.go @@ -0,0 +1,34 @@ +package global + +import ( + "net/http" + "time" +) + +var LAST_MODIFIED = time.Now() + +var MimeTypes = map[string]string{ + "css": "text/css; charset=utf-8", + "png": "image/png", + "jpg": "image/jpg", + "webp": "image/webp", + "html": "text/html", + "asc": "text/plain", + "pub": "text/plain", + "js": "application/javascript", +} + +func IsModified(req *http.Request, last_modified time.Time) bool { + if len(req.Header["If-Modified-Since"]) == 0 || len(req.Header["If-Modified-Since"][0]) == 0 { + return true + } + request_time, err := time.Parse(http.TimeFormat, req.Header["If-Modified-Since"][0]) + if err != nil { + return true + } + if request_time.Before(last_modified) { + return true + } + return false +} + diff --git a/main.go b/main.go index 040359f..8cb355f 100644 --- a/main.go +++ b/main.go @@ -5,278 +5,212 @@ import ( "html/template" "log" "net/http" - "os" "strconv" - "strings" "time" - "arimelody.me/arimelody.me/api" + "arimelody.me/arimelody.me/api/v1/admin" "arimelody.me/arimelody.me/api/v1/music" - - "github.com/gomarkdown/markdown" - "github.com/gomarkdown/markdown/html" - "github.com/gomarkdown/markdown/parser" ) -const PORT int = 8080 -var LAST_MODIFIED = time.Now() - -var mime_types = map[string]string{ - "css": "text/css; charset=utf-8", - "png": "image/png", - "jpg": "image/jpg", - "webp": "image/webp", - "html": "text/html", - "asc": "text/plain", - "pub": "text/plain", - "js": "application/javascript", -} +const DEFAULT_PORT int = 8080 var base_template = template.Must(template.ParseFiles( - "views/base.html", - "views/header.html", - "views/footer.html", - "views/prideflag.html", + "views/base.html", + "views/header.html", + "views/footer.html", + "views/prideflag.html", )) -// var htmx_template = template.Must(template.New("root").Parse(`{{block "head" .}}{{end}}{{block "content" .}}{{end}}`)) func log_request(req *http.Request, code int, start_time time.Time) { - now := time.Now() - difference := (now.Nanosecond() - start_time.Nanosecond()) / 1_000_000 - elapsed := "<1" - if difference >= 1 { - elapsed = strconv.Itoa(difference) - } + now := time.Now() + difference := (now.Nanosecond() - start_time.Nanosecond()) / 1_000_000 + elapsed := "<1" + if difference >= 1 { + elapsed = strconv.Itoa(difference) + } - fmt.Printf("[%s] %s %s - %d (%sms) (%s)\n", - now.Format(time.UnixDate), - req.Method, - req.URL.Path, - code, - elapsed, - req.Header["User-Agent"][0], -) + fmt.Printf("[%s] %s %s - %d (%sms) (%s)\n", + now.Format(time.UnixDate), + req.Method, + req.URL.Path, + code, + elapsed, + req.Header["User-Agent"][0]) } -func handle_request(writer http.ResponseWriter, req *http.Request) { - uri := req.URL.Path - start_time := time.Now() - - // hx_request := len(req.Header["Hx-Request"]) > 0 && req.Header["Hx-Request"][0] == "true" - // - // // don't bother fulfilling requests to a page that's already loaded on the client! - // if hx_request && len(req.Header["Referer"]) > 0 && len(req.Header["Hx-Current-Url"]) > 0 { - // regex := regexp.MustCompile(`https?:\/\/[^\/]+`) - // current_location := regex.ReplaceAllString(req.Header["Hx-Current-Url"][0], "") - // if current_location == req.URL.Path { - // writer.WriteHeader(204); - // return - // } - // } - - writer.Header().Set("Server", "arimelody.me") - writer.Header().Set("Cache-Control", "max-age=86400") - writer.Header().Set("Last-Modified", LAST_MODIFIED.Format(http.TimeFormat)) - - code := func(writer http.ResponseWriter, req *http.Request) int { - // var root *template.Template - // if hx_request { - // root = template.Must(htmx_template.Clone()) - // } else { - // root = template.Must(base_template.Clone()) - // } - - var root = template.Must(base_template.Clone()) - - if req.URL.Path == "/" { - return handle_index(writer, req, root) - } - - if uri == "/music" || uri == "/music/" { - return handle_music(writer, req, root) - } - - if strings.HasPrefix(uri, "/music/") { - return handle_music_gateway(writer, req, root) - } - - if strings.HasPrefix(uri, "/admin") { - return handle_admin(writer, req, root) - } - - if strings.HasPrefix(uri, "/api") { - return api.Handle(writer, req, root) - } - - return static_handler(writer, req, root) - }(writer, req) - - log_request(req, code, start_time) -} - -func handle_index(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - if !was_modified(req, LAST_MODIFIED) { - writer.WriteHeader(304) - return 304 - } - - index_template := template.Must(root.ParseFiles("views/index.html")) - err := index_template.Execute(writer, nil) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - return 200 -} - -func handle_music(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - if !was_modified(req, LAST_MODIFIED) { - writer.WriteHeader(304) - return 304 - } - - music_template := template.Must(root.ParseFiles("views/music.html")) - music := music.QueryAllMusic() - err := music_template.Execute(writer, music) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - return 200 -} - -func handle_music_gateway(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - if !was_modified(req, LAST_MODIFIED) { - writer.WriteHeader(304) - return 304 - } - - id := req.URL.Path[len("/music/"):] - // http.Redirect(writer, req, "https://mellodoot.com/music/"+title, 302) - // return - release, ok := music.GetRelease(id) - if !ok { - return handle_not_found(writer, req, root) - } - gateway_template := template.Must(root.ParseFiles("views/music-gateway.html")) - err := gateway_template.Execute(writer, release) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - return 200 -} - -func handle_admin(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - if !was_modified(req, LAST_MODIFIED) { - writer.WriteHeader(304) - return 304 - } - - admin_template := template.Must(root.ParseFiles("views/admin.html")) - err := admin_template.Execute(writer, nil) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - return 200 -} - -func static_handler(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - filename := "public/" + req.URL.Path[1:] - - // check the file's metadata - info, err := os.Stat(filename) - if err != nil { - return handle_not_found(writer, req, root) - } - - if !was_modified(req, info.ModTime()) { - writer.WriteHeader(304) - return 304 - } - - // set Last-Modified to file modification date - writer.Header().Set("Last-Modified", info.ModTime().Format(http.TimeFormat)) - - // read the file - body, err := os.ReadFile(filename) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - - // setting MIME types - filetype := filename[strings.LastIndex(filename, ".")+1:] - if mime_type, ok := mime_types[filetype]; ok { - writer.Header().Set("Content-Type", mime_type) - } else { - writer.Header().Set("Content-Type", "text/plain; charset=utf-8") - } - - writer.Write([]byte(body)) - return 200 -} - -func handle_not_found(writer http.ResponseWriter, req *http.Request, root *template.Template) int { - type ErrorData struct { - Target string - } - error_data := ErrorData{ Target: req.URL.Path } - writer.WriteHeader(404); - error_template := template.Must(root.ParseFiles("views/404.html")) - err := error_template.Execute(writer, error_data) - if err != nil { - http.Error(writer, err.Error(), http.StatusInternalServerError) - return 500 - } - return 404 -} - -func was_modified(req *http.Request, last_modified time.Time) bool { - if len(req.Header["If-Modified-Since"]) == 0 || len(req.Header["If-Modified-Since"][0]) == 0 { - return true - } - request_time, err := time.Parse(http.TimeFormat, req.Header["If-Modified-Since"][0]) - if err != nil { - return true - } - if request_time.Before(last_modified) { - return true - } - return false -} - -func parse_markdown(md []byte) []byte { - extensions := parser.CommonExtensions | parser.AutoHeadingIDs | parser.NoEmptyLineBeforeBlock - p := parser.NewWithExtensions(extensions) - doc := p.Parse(md) - - htmlFlags := html.CommonFlags - opts := html.RendererOptions{Flags: htmlFlags} - renderer := html.NewRenderer(opts) - - return markdown.Render(doc, renderer) -} - -func push_to_db_this_is_a_testing_thing_and_will_be_superfluous_later() { - db := InitDatabase() - defer db.Close() - - for _, artist := range music.QueryAllArtists() { - PushArtist(db, artist) - } - - for _, album := range music.QueryAllMusic() { - PushRelease(db, album) - } -} +// func handle_request(res http.ResponseWriter, req *http.Request) { +// uri := req.URL.Path +// start_time := time.Now() +// +// res.Header().Set("Server", "arimelody.me") +// +// code := func(res http.ResponseWriter, req *http.Request) int { +// var root = template.Must(base_template.Clone()) +// +// if req.URL.Path == "/" { +// return handle_index(res, req, root) +// } +// +// if uri == "/music" || uri == "/music/" { +// return handle_music(res, req, root) +// } +// +// if strings.HasPrefix(uri, "/music/") { +// return handle_music_gateway(res, req, root) +// } +// +// if strings.HasPrefix(uri, "/admin") { +// return admin.Handle(res, req, root) +// } +// +// if strings.HasPrefix(uri, "/api") { +// return api.Handle(res, req, root) +// } +// +// return static_handler(res, req, root) +// }(res, req) +// +// log_request(req, code, start_time) +// } +// +// func handle_index(res http.ResponseWriter, req *http.Request, root *template.Template) int { +// if !global.IsModified(req, global.LAST_MODIFIED) { +// res.WriteHeader(304) +// return 304 +// } +// +// index_template := template.Must(root.ParseFiles("views/index.html")) +// err := index_template.Execute(res, nil) +// if err != nil { +// http.Error(res, err.Error(), http.StatusInternalServerError) +// return 500 +// } +// return 200 +// } +// +// func handle_music(res http.ResponseWriter, req *http.Request, root *template.Template) int { +// if !global.IsModified(req, global.LAST_MODIFIED) { +// res.WriteHeader(304) +// return 304 +// } +// +// music_template := template.Must(root.ParseFiles("views/music.html")) +// err := music_template.Execute(res, music.Releases) +// if err != nil { +// http.Error(res, err.Error(), http.StatusInternalServerError) +// return 500 +// } +// return 200 +// } +// +// func handle_music_gateway(res http.ResponseWriter, req *http.Request, root *template.Template) int { +// if !global.IsModified(req, global.LAST_MODIFIED) { +// res.WriteHeader(304) +// return 304 +// } +// +// id := req.URL.Path[len("/music/"):] +// release, err := music.GetRelease(id) +// if err != nil { +// return handle_not_found(res, req, root) +// } +// gateway_template := template.Must(root.ParseFiles("views/music-gateway.html")) +// err = gateway_template.Execute(res, release) +// if err != nil { +// http.Error(res, err.Error(), http.StatusInternalServerError) +// return 500 +// } +// return 200 +// } +// +// func static_handler(res http.ResponseWriter, req *http.Request, root *template.Template) int { +// filename := "public/" + req.URL.Path[1:] +// +// // check the file's metadata +// info, err := os.Stat(filename) +// if err != nil { +// return handle_not_found(res, req, root) +// } +// +// if !global.IsModified(req, info.ModTime()) { +// res.WriteHeader(304) +// return 304 +// } +// +// // set Last-Modified to file modification date +// res.Header().Set("Last-Modified", info.ModTime().Format(http.TimeFormat)) +// +// // read the file +// body, err := os.ReadFile(filename) +// if err != nil { +// http.Error(res, err.Error(), http.StatusInternalServerError) +// return 500 +// } +// +// // setting MIME types +// filetype := filename[strings.LastIndex(filename, ".")+1:] +// if mime_type, ok := global.MimeTypes[filetype]; ok { +// res.Header().Set("Content-Type", mime_type) +// } else { +// res.Header().Set("Content-Type", "text/plain; charset=utf-8") +// } +// +// res.Write([]byte(body)) +// return 200 +// } +// +// func handle_not_found(res http.ResponseWriter, req *http.Request, root *template.Template) int { +// type ErrorData struct { +// Target string +// } +// error_data := ErrorData{ Target: req.URL.Path } +// res.WriteHeader(404); +// error_template := template.Must(root.ParseFiles("views/404.html")) +// err := error_template.Execute(res, error_data) +// if err != nil { +// http.Error(res, err.Error(), http.StatusInternalServerError) +// return 500 +// } +// return 404 +// } +// +// func parse_markdown(md []byte) []byte { +// extensions := parser.CommonExtensions | parser.AutoHeadingIDs | parser.NoEmptyLineBeforeBlock +// p := parser.NewWithExtensions(extensions) +// doc := p.Parse(md) +// +// htmlFlags := html.CommonFlags +// opts := html.RendererOptions{Flags: htmlFlags} +// renderer := html.NewRenderer(opts) +// +// return markdown.Render(doc, renderer) +// } func main() { - push_to_db_this_is_a_testing_thing_and_will_be_superfluous_later() + db := InitDatabase() + defer db.Close() + + var err error + music.Artists, err = PullAllArtists(db) + if err != nil { + fmt.Printf("Failed to pull artists from database: %v\n", err); + panic(1) + } + music.Releases, err = PullAllReleases(db) + if err != nil { + fmt.Printf("Failed to pull releases from database: %v\n", err); + panic(1) + } - http.HandleFunc("/", handle_request) + mux := http.NewServeMux() - fmt.Printf("now serving at http://127.0.0.1:%d\n", PORT) - log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", PORT), nil)) + mux.Handle("/api/v1/admin", admin.Handler()) + mux.Handle("/api/v1/admin/login", admin.LoginHandler()) + mux.Handle("/api/v1/admin/callback", admin.OAuthCallbackHandler()) + mux.Handle("/api/v1/admin/verify", admin.AuthorisedHandler(admin.VerifyHandler())) + mux.Handle("/api/v1/admin/logout", admin.AuthorisedHandler(admin.LogoutHandler())) + + port := DEFAULT_PORT + fmt.Printf("now serving at http://127.0.0.1:%d\n", port) + log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), mux)) } diff --git a/public/img/buttons/elke.gif b/public/img/buttons/elke.gif new file mode 100644 index 0000000..ed35057 Binary files /dev/null and b/public/img/buttons/elke.gif differ diff --git a/public/img/buttons/itzzen.png b/public/img/buttons/itzzen.png new file mode 100644 index 0000000..d9dc2ea Binary files /dev/null and b/public/img/buttons/itzzen.png differ diff --git a/public/img/buttons/misc/blink.gif b/public/img/buttons/misc/blink.gif new file mode 100644 index 0000000..2acde1c Binary files /dev/null and b/public/img/buttons/misc/blink.gif differ diff --git a/public/img/favicon-256.png b/public/img/favicon-256.png new file mode 100644 index 0000000..d8f8cea Binary files /dev/null and b/public/img/favicon-256.png differ diff --git a/public/img/favicon-36.png b/public/img/favicon-36.png new file mode 100644 index 0000000..1a6df8e Binary files /dev/null and b/public/img/favicon-36.png differ diff --git a/public/img/favicon.png b/public/img/favicon.png index c938324..14c720a 100644 Binary files a/public/img/favicon.png and b/public/img/favicon.png differ diff --git a/public/img/mailicon.svg b/public/img/mailicon.svg index 170bbd9..bd0e8dd 100644 --- a/public/img/mailicon.svg +++ b/public/img/mailicon.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + diff --git a/public/img/prideflag.svg b/public/img/prideflag.svg new file mode 100644 index 0000000..86654df --- /dev/null +++ b/public/img/prideflag.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/public/script/music-gateway.js b/public/script/music-gateway.js index b625caf..ef18fcc 100644 --- a/public/script/music-gateway.js +++ b/public/script/music-gateway.js @@ -1,79 +1,73 @@ import "./main.js"; function apply_funny_bob_to_upcoming_tags() { - const upcoming_tags = document.querySelectorAll("#type.upcoming"); - for (var i = 0; i < upcoming_tags.length; i++) { - const tag = upcoming_tags[i]; - const chars = tag.innerText.split(""); - const result = chars.map((c, i) => `${c}`); - tag.innerHTML = result.join(""); - } + const upcoming_tags = document.querySelectorAll("#type.upcoming"); + for (var i = 0; i < upcoming_tags.length; i++) { + const tag = upcoming_tags[i]; + const chars = tag.innerText.split(""); + const result = chars.map((c, i) => `${c}`); + tag.innerHTML = result.join(""); + } } function update_extras_buttons() { - const extras_pairs = Array.from(document.querySelectorAll("div#info > div").values()).map(container => { - return { - container, - button: document.getElementById("extras").querySelector(`ul li a[href="#${container.id}"]`) - }; - }); - const info_container = document.getElementById("info") - info_container.addEventListener("scroll", update_extras_buttons); - const info_rect = info_container.getBoundingClientRect(); - const info_y = info_rect.y; - const font_size = parseFloat(getComputedStyle(document.documentElement).fontSize); - let current = extras_pairs[0]; - extras_pairs.forEach(pair => { - pair.button.classList.remove("active"); - const scroll_diff = pair.container.getBoundingClientRect().y - - info_rect.y - - info_rect.height / 2 + - 4 * font_size; - if (scroll_diff <= 0) current = pair; - }) - current.button.classList.add("active"); + const extras_pairs = Array.from(document.querySelectorAll("div#info > div").values()).map(container => { + return { + container, + button: document.getElementById("extras").querySelector(`ul li a[href="#${container.id}"]`) + }; + }); + const info_container = document.getElementById("info") + info_container.addEventListener("scroll", update_extras_buttons); + const info_rect = info_container.getBoundingClientRect(); + const info_y = info_rect.y; + const font_size = parseFloat(getComputedStyle(document.documentElement).fontSize); + let current = extras_pairs[0]; + extras_pairs.forEach(pair => { + pair.button.classList.remove("active"); + const scroll_diff = pair.container.getBoundingClientRect().y - + info_rect.y - + info_rect.height / 2 + + 4 * font_size; + if (scroll_diff <= 0) current = pair; + }) + current.button.classList.add("active"); - document.querySelectorAll("div#extras ul li a[href]").forEach(link => { - link.addEventListener("click", event => { - event.preventDefault(); - location.replace(link.href); - }); + document.querySelectorAll("div#extras ul li a[href]").forEach(link => { + link.addEventListener("click", event => { + event.preventDefault(); + const tag = link.href.split('#').slice(-1)[0]; + document.getElementById(tag).scrollIntoView(); }); + }); } function bind_go_back_btn() { - const go_back_btn = document.getElementById("go-back") - go_back_btn.innerText = "<"; - go_back_btn.addEventListener("click", () => { - window.history.back(); - }); + const go_back_btn = document.getElementById("go-back") + go_back_btn.innerText = "<"; + go_back_btn.addEventListener("click", () => { + window.history.back(); + }); } function bind_share_btn() { - const share_btn = document.getElementById("share"); - if (navigator.clipboard === undefined) { - share_btn.onclick = event => { - console.error("clipboard is not supported by this browser!"); - }; - return; - } + const share_btn = document.getElementById("share"); + if (navigator.clipboard === undefined) { share_btn.onclick = event => { - event.preventDefault(); - navigator.clipboard.writeText(window.location.href); - share_btn.classList.remove('active'); - void share_btn.offsetWidth; - share_btn.classList.add('active'); - } + console.error("clipboard is not supported by this browser!"); + }; + return; + } + share_btn.onclick = event => { + event.preventDefault(); + navigator.clipboard.writeText(window.location.href); + share_btn.classList.remove('active'); + void share_btn.offsetWidth; + share_btn.classList.add('active'); + } } -function start() { - bind_share_btn(); - bind_go_back_btn(); - apply_funny_bob_to_upcoming_tags(); - update_extras_buttons(); -} - -document.addEventListener("swap", () => { - if (!window.location.pathname.startsWith("/music/")) return; - start(); -}); +bind_share_btn(); +bind_go_back_btn(); +apply_funny_bob_to_upcoming_tags(); +update_extras_buttons(); diff --git a/public/style/music-gateway.css b/public/style/music-gateway.css index c3a519d..55ed16c 100644 --- a/public/style/music-gateway.css +++ b/public/style/music-gateway.css @@ -1,640 +1,641 @@ @font-face { - font-family: "Monaspace Argon"; - src: url("/font/monaspace-argon/MonaspaceArgonVarVF[wght,wdth,slnt].woff2") format("woff2-variations"); - font-weight: 125 950; - font-stretch: 75% 125%; - font-style: oblique 0deg 20deg; + font-family: "Monaspace Argon"; + src: url("/font/monaspace-argon/MonaspaceArgonVarVF[wght,wdth,slnt].woff2") format("woff2-variations"); + font-weight: 125 950; + font-stretch: 75% 125%; + font-style: oblique 0deg 20deg; } html, body { - margin: 0; - padding: 0; - font-size: 18px; - color: #fff; - background-color: #111; - font-family: "Monaspace Argon", monospace; + margin: 0; + padding: 0; + font-size: 16px; + line-height: 1.5em; + color: #fff; + background-color: #111; + font-family: "Monaspace Argon", monospace; } #background { - position: fixed; - top: 0; - left: 0; - width: 100vw; - height: 100vh; - background-size: cover; - background-position: center; - filter: blur(25px) saturate(25%) brightness(0.5); - -webkit-filter: blur(25px) saturate(25%) brightness(0.5);; - animation: background-init .5s forwards,background-loop 30s ease-in-out infinite + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + background-size: cover; + background-position: center; + filter: blur(25px) saturate(25%) brightness(0.5); + -webkit-filter: blur(25px) saturate(25%) brightness(0.5);; + animation: background-init .5s forwards,background-loop 30s ease-in-out infinite } #go-back { - position: fixed; - top: 4rem; - left: 1rem; - width: 2.5rem; - height: 2.5rem; - margin: 0; - font-size: 1.5rem; - line-height: 2.6rem; - display: flex; - justify-content: center; - color: #fff; - background-color: #111; - border-radius: 4px; - text-decoration: none; - box-shadow: 0 0 8px #0004; - z-index: 1; + position: fixed; + top: 4rem; + left: 1rem; + width: 2.5rem; + height: 2.5rem; + margin: 0; + font-size: 1.5rem; + line-height: 2.6rem; + display: flex; + justify-content: center; + color: #fff; + background-color: #111; + border-radius: 4px; + text-decoration: none; + box-shadow: 0 0 8px #0004; + z-index: 1; } main { - position: absolute; - top: 3rem; - width: 100vw; - min-height: calc(100vh - 9rem); - margin: 0; - display: flex; - justify-content: center; - align-items: center; + position: absolute; + top: 3rem; + width: 100vw; + min-height: calc(100vh - 9rem); + margin: 0; + display: flex; + justify-content: center; + align-items: center; } #music-container { - width: min(960px, calc(100vw - 4rem)); - height: 360px; - display: flex; - flex-direction: row; - flex-wrap: nowrap; - gap: 4rem; - font-size: 16px; - animation: card-init .5s forwards; - padding: 4rem; + width: min(960px, calc(100vw - 4rem)); + height: 360px; + display: flex; + flex-direction: row; + flex-wrap: nowrap; + gap: 4rem; + font-size: 16px; + animation: card-init .5s forwards; + padding: 4rem; } #art-container { - display: flex; - align-items: center; - position: relative; - width: 20rem; - transition: transform .5s cubic-bezier(0,0,0,1); + display: flex; + align-items: center; + position: relative; + width: 20rem; + transition: transform .5s cubic-bezier(0,0,0,1); } #art-container:hover { - transform: scale(1.05) translateY(-5px); + transform: scale(1.05) translateY(-5px); } #art-container:hover img#artwork { - box-shadow: 0 16px 18px #0003; + box-shadow: 0 16px 18px #0003; } /* TILT CONTROLS */ #art-container > div { - position: absolute; - width: 33.3%; - height: 33.3%; - z-index: 2; + position: absolute; + width: 33.3%; + height: 33.3%; + z-index: 2; } #art-container > div.tilt-topleft { - top: 0; - left: 0; + top: 0; + left: 0; } #art-container > div.tilt-topleft:hover ~ #artwork { - transform: rotate3d(-1, 1, 0, 20deg); - filter: brightness(var(--shine)); - -webkit-filter: brightness(var(--shine)); + transform: rotate3d(-1, 1, 0, 20deg); + filter: brightness(var(--shine)); + -webkit-filter: brightness(var(--shine)); } #art-container > div.tilt-top { - top: 0; - left: 33.3%; + top: 0; + left: 33.3%; } #art-container > div.tilt-top:hover ~ #artwork { - transform: rotate3d(-1, 0, 0, 20deg); - filter: brightness(var(--shine)); - -webkit-filter: brightness(var(--shine)); + transform: rotate3d(-1, 0, 0, 20deg); + filter: brightness(var(--shine)); + -webkit-filter: brightness(var(--shine)); } #art-container > div.tilt-topright { - top: 0; - right: 0; + top: 0; + right: 0; } #art-container > div.tilt-topright:hover ~ #artwork { - transform: rotate3d(-1, -1, 0, 20deg); - filter: brightness(var(--shine)); - -webkit-filter: brightness(var(--shine)); + transform: rotate3d(-1, -1, 0, 20deg); + filter: brightness(var(--shine)); + -webkit-filter: brightness(var(--shine)); } #art-container > div.tilt-right { - top: 33.3%; - right: 0; + top: 33.3%; + right: 0; } #art-container > div.tilt-right:hover ~ #artwork { - transform: rotate3d(0, -1, 0, 20deg); + transform: rotate3d(0, -1, 0, 20deg); } #art-container > div.tilt-bottomright { - bottom: 0; - right: 0; + bottom: 0; + right: 0; } #art-container > div.tilt-bottomright:hover ~ #artwork { - transform: rotate3d(1, -1, 0, 20deg); - filter: brightness(var(--shadow)); - -webkit-filter: brightness(var(--shadow)); + transform: rotate3d(1, -1, 0, 20deg); + filter: brightness(var(--shadow)); + -webkit-filter: brightness(var(--shadow)); } #art-container > div.tilt-bottom { - bottom: 0; - left: 33.3%; + bottom: 0; + left: 33.3%; } #art-container > div.tilt-bottom:hover ~ #artwork { - transform: rotate3d(1, 0, 0, 20deg); - filter: brightness(var(--shadow)); - -webkit-filter: brightness(var(--shadow)); + transform: rotate3d(1, 0, 0, 20deg); + filter: brightness(var(--shadow)); + -webkit-filter: brightness(var(--shadow)); } #art-container > div.tilt-bottomleft { - bottom: 0; - left: 0; + bottom: 0; + left: 0; } #art-container > div.tilt-bottomleft:hover ~ #artwork { - transform: rotate3d(1, 1, 0, 20deg); - filter: brightness(var(--shadow)); - -webkit-filter: brightness(var(--shadow)); + transform: rotate3d(1, 1, 0, 20deg); + filter: brightness(var(--shadow)); + -webkit-filter: brightness(var(--shadow)); } #art-container > div.tilt-left { - top: 33.3%; - left: 0; + top: 33.3%; + left: 0; } #art-container > div.tilt-left:hover ~ #artwork { - transform: rotate3d(0, 1, 0, 20deg); + transform: rotate3d(0, 1, 0, 20deg); } /* TILT CONTROLS */ #artwork { - --shine: 1.05; - --shadow: 0.8; - width: 360px; - height: 360px; - margin: auto; - display: flex; - justify-content: center; - line-height: 15rem; - border-radius: 4px; - color: #888; - background-color: #ccc; - box-shadow: 0 16px 16px #0004; - transition: transform 1s cubic-bezier(0,0,0,1), filter .3s linear, box-shadow .3s linear; + --shine: 1.05; + --shadow: 0.8; + width: 360px; + height: 360px; + margin: auto; + display: flex; + justify-content: center; + line-height: 15rem; + border-radius: 4px; + color: #888; + background-color: #ccc; + box-shadow: 0 16px 16px #0004; + transition: transform 1s cubic-bezier(0,0,0,1), filter .3s linear, box-shadow .3s linear; } div#vertical-line { - width: 1px; - background-color: #fff4; + width: 1px; + background-color: #fff4; } div#info { - margin: -4rem; - padding: 4rem; - height: 360px; - overflow: scroll; - scroll-behavior: smooth; - mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%); + margin: -4rem; + padding: 4rem; + height: 360px; + overflow: scroll; + scroll-behavior: smooth; + mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%); - -ms-overflow-style: none; - scrollbar-width: none; - ::-webkit-scrollbar { - display: none; - } + -ms-overflow-style: none; + scrollbar-width: none; + ::-webkit-scrollbar { + display: none; + } } div#info > div { - min-width: 420px; - min-height: 360px; - padding: 4rem 1rem 4rem 4rem; - margin: -4rem -3.5rem -4rem -4rem; + min-width: 420px; + min-height: 360px; + padding: 4rem 1rem 4rem 4rem; + margin: -4rem -3.5rem -4rem -4rem; } div#info p { - max-width: 500px; - white-space: pre-line; + max-width: 500px; + white-space: pre-line; } #title-container { - display: flex; - align-items: last baseline; - flex-direction: row; + display: flex; + align-items: last baseline; + flex-direction: row; } #title { - margin: 0; - line-height: 1em; - font-size: 2.5em; + margin: 0; + line-height: 1em; + font-size: 2.5em; } #year { - margin-left: .9em; - font-size: 1.2em; - color: #eee8; - font-weight: bold; + margin-left: .9em; + font-size: 1.2em; + color: #eee8; + font-weight: bold; } #artist { - margin: .2em 0 1em 0; - font-size: 1em; - color: #eee; + margin: .2em 0 1em 0; + font-size: 1em; + color: #eee; } #title, #artist { - text-shadow: 0 .05em 2px #0004 + text-shadow: 0 .05em 2px #0004 } #type { - display: inline-block; - margin: 0; - padding: .3em .8em; - color: #fff; - background-color: #111; - text-transform: uppercase; - border-radius: 4px; + display: inline-block; + margin: 0; + padding: .3em .8em; + color: #fff; + background-color: #111; + text-transform: uppercase; + border-radius: 4px; } #type.single { - background-color: #3b47f4; + background-color: #3b47f4; } #type.ep { - background-color: #f419bd + background-color: #f419bd } #type.album { - background-color: #34c627 + background-color: #34c627 } #type.comp { - background-color: #ee8d46 + background-color: #ee8d46 } #type.upcoming { - background-color: #ff3e3e + background-color: #ff3e3e } #type.upcoming span { - animation: bob 2s ease-in-out infinite; - display: inline-block; + animation: bob 2s ease-in-out infinite; + display: inline-block; } ul#links { - width: 100%; - margin: 1rem 0; - padding: 0; - display: flex; - flex-direction: row; - flex-wrap: wrap; - gap: .5rem; - list-style: none; + width: 100%; + margin: 1rem 0; + padding: 0; + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: .5rem; + list-style: none; } ul#links li { - flex-grow: 1; + flex-grow: 1; } ul#links a { - width: calc(100% - 1.6em); - padding: .5em .8em; - display: block; - border-radius: 4px; - font-size: 1em; - color: #111; - background-color: #fff; - text-align: center; - text-decoration: none; - transition: filter .1s,-webkit-filter .1s + width: calc(100% - 1.6em); + padding: .5em .8em; + display: block; + border-radius: 4px; + font-size: 1em; + color: #111; + background-color: #fff; + text-align: center; + text-decoration: none; + transition: filter .1s,-webkit-filter .1s } ul#links a.buy { - background-color: #ff94e9 + background-color: #ff94e9 } ul#links a.presave { - background-color: #ff94e9 + background-color: #ff94e9 } ul#links a.spotify { - background-color: #8cff83 + background-color: #8cff83 } ul#links a.applemusic { - background-color: #8cd9ff + background-color: #8cd9ff } ul#links a.soundcloud { - background-color: #fdaa6d + background-color: #fdaa6d } ul#links a.youtube { - background-color: #ff6e6e + background-color: #ff6e6e } ul#links a:hover { - filter: brightness(125%); - -webkit-filter: brightness(125%) + filter: brightness(125%); + -webkit-filter: brightness(125%) } #description { - font-size: 1.2em; + font-size: 1.2em; } #share { - margin: 0; - padding: 0; - display: inline-block; - color: inherit; - font-family: inherit; - font-size: inherit; - line-height: 1em; - text-shadow: 0 .05em 2px #0004; - cursor: pointer; - opacity: .5; - background: none; - border: none; - transition: opacity .1s linear; + margin: 0; + padding: 0; + display: inline-block; + color: inherit; + font-family: inherit; + font-size: inherit; + line-height: 1em; + text-shadow: 0 .05em 2px #0004; + cursor: pointer; + opacity: .5; + background: none; + border: none; + transition: opacity .1s linear; } #share:hover { - opacity: 1; + opacity: 1; } #share.active { - animation: share-click .5s forwards + animation: share-click .5s forwards } #share.active::after { - content: "✓"; - position: relative; - left: .2em; - font-size: 1.2em; - line-height: 1em; - animation: share-after 2s cubic-bezier(.5,0,1,.5) forwards + content: "✓"; + position: relative; + left: .2em; + font-size: 1.2em; + line-height: 1em; + animation: share-after 2s cubic-bezier(.5,0,1,.5) forwards } div#extras ul { - height: 100%; - display: flex; - padding: 0; - flex-direction: column; - margin: 0 -.5rem; - position: relative; + height: 100%; + display: flex; + padding: 0; + flex-direction: column; + margin: 0 -.5rem; + position: relative; } div#extras ul li { - flex-grow: 1; - display: flex; - width: 0; + flex-grow: 1; + display: flex; + width: 0; } div#extras ul li a { - padding: 0 .5rem; - writing-mode: vertical-rl; - text-align: center; - color: #888; - text-decoration: none; - font-style: italic; - transition: color .1s linear; + padding: 0 .5rem; + writing-mode: vertical-rl; + text-align: center; + color: #888; + text-decoration: none; + font-style: italic; + transition: color .1s linear; } div#extras ul li a:hover, div#extras ul li a.active { - color: #eee; + color: #eee; } #credits ul { - list-style: "> "; + list-style: "> "; } #credits ul li { - margin-bottom: 1rem; + margin-bottom: 1rem; } -#tracks h3 { - margin-bottom: .5rem; - padding: 1rem; - background-color: #0008; - cursor: pointer; - transition: background-color .1s linear; +#tracks details[open] { + margin-bottom: 2em; } -#tracks h3:hover { - background-color: #2228; +#tracks summary { + margin-bottom: 1em; + padding: 1em; + background-color: #0008; + cursor: pointer; + transition: background-color .1s linear; } -#tracks h3:active { - background-color: #4448; +#tracks summary:hover { + background-color: #2228; } -#tracks h3.active { - color: #000; - background-color: var(--primary); +#tracks summary:active { + background-color: #4448; } -#tracks p { - margin-bottom: 3em; +#tracks summary.active { + color: #000; + background-color: var(--primary); } footer { - position: fixed; - left: 0; - bottom: 0; - width: 100vw; - height: 6rem; - display: flex; - flex-direction: column; - justify-content: center; - align-items: center; - color: #eee; - background-color: #0008; - backdrop-filter: blur(25px) + position: fixed; + left: 0; + bottom: 0; + width: 100vw; + height: 6rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + color: #eee; + background-color: #0008; + backdrop-filter: blur(25px) } footer p { - margin: 0 + margin: 0 } footer a { - color: inherit; - text-decoration: none + color: inherit; + text-decoration: none } footer a:hover { - text-decoration: underline + text-decoration: underline } @media only screen and (max-width: 1105px) { - main { - min-height: calc(100vh - 4rem); - } + main { + min-height: calc(100vh - 4rem); + } - #music-container { - width: calc(100vw - 8rem); - height: fit-content; - padding: 2rem 0 6rem 0; - gap: 1rem; - font-size: 12px; - flex-direction: column; - text-align: center; - } + #music-container { + width: calc(100vw - 8rem); + height: fit-content; + padding: 2rem 0 6rem 0; + gap: 1rem; + font-size: 12px; + flex-direction: column; + text-align: center; + } - #art-container { - width: 100%; - margin-bottom: 2rem; - } + #art-container { + width: 100%; + margin-bottom: 2rem; + } - #artwork { - width: auto; - max-width: 50vw; - height: auto; - max-height: 50vh; - } + #artwork { + width: auto; + max-width: 50vw; + height: auto; + max-height: 50vh; + } - #vertical-line { - display: none; - } + #vertical-line { + display: none; + } - div#info { - width: 100%; - gap: 2rem; - height: auto; - overflow-y: auto; - } + div#info { + width: 100%; + gap: 2rem; + height: auto; + overflow-y: auto; + } - div#info > div { - min-width: auto; - min-height: auto; - padding: 0; - margin: 0; - overflow-y: unset; - mask-image: none; - } + div#info > div { + min-width: auto; + min-height: auto; + padding: 0; + margin: 0; + overflow-y: unset; + mask-image: none; + } - div#info p { - margin: 0 auto; - } + div#info p { + margin: 0 auto; + } - div#extras { - display: none; - } + div#extras { + display: none; + } - #title-container { - flex-direction: column; - align-items: center; - } + #title-container { + flex-direction: column; + align-items: center; + } - #year { - display: block; - margin: 0; - } + #year { + display: block; + margin: 0; + } - #artist { - margin: .2em auto 1em auto; - } + #artist { + margin: .2em auto 1em auto; + } - #links { - margin: 2rem 0; - justify-content: center; - } + #links { + margin: 2rem 0; + justify-content: center; + } - #extras { - justify-content: center; - } + #extras { + justify-content: center; + } - #credits ul { - padding: 0; - list-style: none; - } + #credits ul { + padding: 0; + list-style: none; + } - #share.active: : after { - transform: translate(calc(-50% - .6em),1.5em); - } + #share.active: : after { + transform: translate(calc(-50% - .6em),1.5em); + } - footer { - height: 4rem; - font-size: .8rem; - } + footer { + height: 4rem; + font-size: .8rem; + } - #pride-flag { - display: none; - } + #pride-flag { + display: none; + } } @keyframes background-init { - from { - opacity: 0 - } - to { - opacity: 1 - } + from { + opacity: 0 + } + to { + opacity: 1 + } } @keyframes background-loop { - from { - transform: scale(1) - } - 50% { - transform: scale(1.05) - } - to { - transform: scale(1) - } + from { + transform: scale(1) + } + 50% { + transform: scale(1.05) + } + to { + transform: scale(1) + } } @keyframes card-init { - from { - opacity: 0; - transform: scale(.9) - } - to { - opacity: 1; - transform: scale(1) - } + from { + opacity: 0; + transform: scale(.9) + } + to { + opacity: 1; + transform: scale(1) + } } @keyframes share-click { - from { - color: #5dfc01 - } - to { - color: #eee - } + from { + color: #5dfc01 + } + to { + color: #eee + } } @keyframes share-after { - from { - opacity: 1 - } - to { - opacity: 0 - } + from { + opacity: 1 + } + to { + opacity: 0 + } } @keyframes bob { - from, - to { - transform: translateY(-10%); - } - 50% { - transform: translateY(10%); - } + from, + to { + transform: translateY(-10%); + } + 50% { + transform: translateY(10%); + } } diff --git a/schema.sql b/schema.sql new file mode 100644 index 0000000..5262ae9 --- /dev/null +++ b/schema.sql @@ -0,0 +1,52 @@ +CREATE TABLE IF NOT EXISTS artists ( + id text NOT NULL, + name text, + website text +); +ALTER TABLE artists ADD CONSTRAINT artists_pk PRIMARY KEY (id); + +CREATE TABLE IF NOT EXISTS musicreleases ( + id character varying(64) NOT NULL, + title text NOT NULL, + type text, + release_date DATE NOT NULL, + artwork text, + buyname text, + buylink text +); +ALTER TABLE musicreleases ADD CONSTRAINT musicreleases_pk PRIMARY KEY (id); + +CREATE TABLE IF NOT EXISTS musiclinks ( + release character varying(64) NOT NULL, + name text NOT NULL, + url text, +); +ALTER TABLE musiclinks ADD CONSTRAINT musiclinks_pk PRIMARY KEY (release, name); + +CREATE TABLE IF NOT EXISTS musiccredits ( + release character varying(64) NOT NULL, + artist text NOT NULL, + role text, + is_primary boolean, +); +ALTER TABLE musiccredits ADD CONSTRAINT musiccredits_pk PRIMARY KEY (release, artist); + +CREATE TABLE IF NOT EXISTS musictracks ( + release character varying(64) NOT NULL, + number integer NOT NULL, + title text NOT NULL, + description text, + lyrics text, + preview_url text, +); +ALTER TABLE musictracks ADD CONSTRAINT musictracks_pk PRIMARY KEY (release, number); + +-- foreign keys + +ALTER TABLE public.musiccredits ADD CONSTRAINT musiccredits_artist_fk FOREIGN KEY (artist) REFERENCES public.artists(id) ON DELETE CASCADE; + +ALTER TABLE public.musiccredits ADD CONSTRAINT musiccredits_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON DELETE CASCADE; + +ALTER TABLE public.musiclinks ADD CONSTRAINT musiclinks_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON UPDATE CASCADE ON DELETE CASCADE; + +ALTER TABLE public.musictracks ADD CONSTRAINT musictracks_release_fk FOREIGN KEY (release) REFERENCES public.musicreleases(id) ON DELETE CASCADE; diff --git a/views/admin.html b/views/admin.html index 3349920..5276a9a 100644 --- a/views/admin.html +++ b/views/admin.html @@ -14,7 +14,9 @@

- bappity boopity + whapow! nothing here. +
+ nice try, though.

{{end}} diff --git a/views/base.html b/views/base.html index 9846691..d3d7142 100644 --- a/views/base.html +++ b/views/base.html @@ -13,7 +13,7 @@ - + diff --git a/views/index.html b/views/index.html index 466e86b..f4a6158 100644 --- a/views/index.html +++ b/views/index.html @@ -20,169 +20,166 @@ {{define "content"}}
- +

+ # hello, world! +

-

- # hello, world! -

+

+ i'm ari! +
+ she/her 🏳️‍⚧️🏳️‍🌈💫🦆🇮🇪 +

+

+ i'm a musician, developer, + streamer, youtuber, + and probably a bunch of other things i forgot to mention! +

+

+ you're very welcome to take a look around my little space on the internet here, + or explore any of the other parts i inhabit! +

+

+ if you're looking to support me financially, that's so cool of you!! + if you like, you can buy some of my music over on + bandcamp + so you can at least get something for your money. + thank you very much either way!! 💕 +

+

+ for anything else, you can reach me for any and all communications through + ari@arimelody.me. if your message + contains anything beyond a silly gag, i strongly recommend encrypting + your message using my public pgp key, listed below! +

+

+ thank you for stopping by- i hope you have a lovely rest of your day! 💫 +

-

- i'm ari! -
- she/her 🏳️‍⚧️🏳️‍🌈💫🦆🇮🇪 -

+
-

- i like to create things on the internet! namely music, - videos, art (link pending), and the odd - code project from time to time! - if it's a thing you can create on a computer, i've probably taken a swing at it. -

-

- you're very welcome to take a look around my little slice of the internet here, - or explore any of the other corners i inhabit! -

-

- and if you're looking to support me financially, that's so cool of you!! - if you like, you can buy one or more of my songs over on - bandcamp, - so you can at least get something for your money. - thank you very much either way!! 💕 -

-

- for anything else, you can reach me for any and all communications through - ari@arimelody.me. if your message - contains anything beyond a silly gag, i strongly recommend encrypting - your message using my public pgp key, listed below! -

-

- thank you for stopping by- i hope you have a lovely rest of your day! 💫 -

+

+ ## metadata +

+ +

+ my colours 🌈 +

+ + +

+ my keys 🔑 +

+ + +

+ where to find me 🛰️ +

+ + +

+ projects i've worked on 🛠️ +

+ + +
+ +

+ ## cool people +

+ +
+ + ari melody web button + + + zaire web button + + + vimae web button + + + zvava web button + + + elke web button + + + itzzen web button +
-

- ## metadata -

- -

- my colours 🌈 -

- - -

- my keys 🔑 -

- - -

- where to find me 🛰️ -

- - -

- projects i've worked on 🛠️ -

- - -
- -

## cool people

- -
- - ari melody web button - - - zaire web button - - - vimae web button - - - zvava web button - - -
- - powered by debian - girls 4 notepad - this website is GAY - graphic design is my passion - GPLv3 free software - half-life - dis site is hentai FREE - sprunk - go straight to hell - virus alert! click here - wii - www - get mandatory internet explorer - HTML - learn it today! - - high on SMOKE - - - epic blazed - -
+ powered by debian + girls 4 notepad + this website is GAY + graphic design is my passion + GPLv3 free software + half-life + dis site is hentai FREE + sprunk + go straight to hell + virus alert! click here + wii + www + get mandatory internet explorer + HTML - learn it today! + + high on SMOKE + + + epic blazed + + closeup anime blink +
{{end}} diff --git a/views/music-gateway.html b/views/music-gateway.html index ba4971e..d3ad05a 100644 --- a/views/music-gateway.html +++ b/views/music-gateway.html @@ -1,17 +1,17 @@ {{define "head"}} -{{.PrintPrimaryArtists false}} - {{.Title}} +{{.Title}} - {{.PrintPrimaryArtists false true}} - - - + + + - - + + @@ -19,8 +19,8 @@ - - + + @@ -30,137 +30,139 @@ {{define "content"}}
- + -
+
- < -

+ < +

-
-
-
-
-
-
-
-
-
-
- {{.Title}} artwork -
-
-
-
-
-

{{.Title}}

- {{.GetReleaseYear}} -
-

{{.PrintPrimaryArtists false}}

-

{{.ResolveType}}

- - - - {{if .Description}} -

- {{.Description}} -

- {{end}} - - -
- - {{if .Credits}} -
-

credits:

-
    - {{range .Credits}} - {{$Artist := .ResolveArtist}} - {{if $Artist.Website}} -
  • {{$Artist.Name}}: {{.Role}}
  • - {{else}} -
  • {{$Artist.Name}}: {{.Role}}
  • - {{end}} - {{end}} -
-
- {{end}} - - {{if .IsSingle}} - {{$Track := index .Tracks 0}} - {{if $Track.Lyrics}} -
-

lyrics:

-

{{$Track.Lyrics}}

-
- {{end}} - {{else}} -
-

tracks:

- {{range .Tracks}} -

{{.Title}}

-

{{.Lyrics}}

- {{end}} -
- {{end}} -
- - {{if or .Credits not .IsSingle}} -
-
    -
  • overview
  • - - {{if .Credits}} -
  • credits
  • - {{end}} - - {{if .IsSingle}} - {{$Track := index .Tracks 0}} - {{if $Track.Lyrics}} -
  • lyrics
  • - {{end}} - {{else}} -
  • tracks
  • - {{end}} -
-
- {{end}} - - - - - - - - - - - - - - - - - - - - - - - - +
+
+
+
+
+
+
+
+
+
+ {{.Title}} artwork
+
+
+
+
+

{{.Title}}

+ {{.GetReleaseYear}} +
+

{{.PrintPrimaryArtists false true}}

+

{{.ResolveType}}

+ + + + {{if .Description}} +

+ {{.Description}} +

+ {{end}} + + +
+ + {{if .Credits}} +
+

credits:

+
    + {{range .Credits}} + {{$Artist := .ResolveArtist}} + {{if $Artist.Website}} +
  • {{$Artist.Name}}: {{.Role}}
  • + {{else}} +
  • {{$Artist.Name}}: {{.Role}}
  • + {{end}} + {{end}} +
+
+ {{end}} + + {{if .IsSingle}} + {{$Track := index .Tracks 0}} + {{if $Track.Lyrics}} +
+

lyrics:

+

{{$Track.Lyrics}}

+
+ {{end}} + {{else}} +
+

tracks:

+ {{range .Tracks}} +
+ {{.Title}} + {{.Lyrics}} +
+ {{end}} +
+ {{end}} +
+ + {{if or .Credits not .IsSingle}} +
+
    +
  • overview
  • + + {{if .Credits}} +
  • credits
  • + {{end}} + + {{if .IsSingle}} + {{$Track := index .Tracks 0}} + {{if $Track.Lyrics}} +
  • lyrics
  • + {{end}} + {{else}} +
  • tracks
  • + {{end}} +
+
+ {{end}} + + + + + + + + + + + + + + + + + + + + + + + + +
{{end}} diff --git a/views/music.html b/views/music.html index 79ec32d..03b98b1 100644 --- a/views/music.html +++ b/views/music.html @@ -32,7 +32,7 @@

{{$Album.Title}}

-

{{$Album.PrintPrimaryArtists false}}

+

{{$Album.PrintPrimaryArtists false true}}

{{$Album.ResolveType}}

-

- - > "can i use your music in my content?" - +

+ + > "can i use your music in my content?" +

-

- yes! well, in most cases... -

-

- from Dream (2022) onward, all of my self-released songs are - licensed under Creative Commons Attribution-ShareAlike 3.0. anyone may use these - songs freely, so long as they provide credit back to me! -

-

- a great example of some credit text would be as follows: -

-
- music used: mellodoot - Dream
- buy it here: https://arimelody.me/music/dream
- licensed under CC BY-SA 3.0. -
-

- for any songs prior to this, they were all either released by me (in which case, i honestly - don't mind), or in collaboration with chill people who i don't see having an issue with it. - do be sure to ask them about it, though! -

-

- in the event the song you want to use is released under some other label, their usage rights - will more than likely trump whatever i'd otherwise have in mind. i'll try to negotiate some - nice terms, though! ;3 -

-

- i love the idea of other creators using my songs in their work, so if you do happen to use - my stuff in a work you're particularly proud of, feel free to send it my way! -

-

- > ari@arimelody.me -

+

+ yes! well, in most cases... +

+

+ from Dream (2022) onward, all of my self-released songs are + licensed under Creative Commons Attribution-ShareAlike 4.0. + anyone may use and remix these songs freely, so long as they provide credit back to me and link back to this license! + please note that all derivative works must inherit this license. +

+

+ a great example of some credit text would be as follows: +

+
+ music used: mellodoot - Dream
+ https://arimelody.me/music/dream
+ licensed under CC BY-SA 4.0. +
+

+ for any songs prior to this, they were all either released by me (in which case, i honestly + don't mind), or in collaboration with chill people who i don't see having an issue with it. + do be sure to ask them about it, though! +

+

+ in the event the song you want to use is released under some other label, their usage rights + will more than likely trump whatever i'd otherwise have in mind. i'll try to negotiate some + nice terms, though! ;3 +

+

+ i love the idea of other creators using my songs in their work, so if you do happen to use + my stuff in a work you're particularly proud of, feel free to send it my way! +

+

+ > ari@arimelody.me +

back to top