update module URLs to use hacklab.nilfm.cc; use struct tags for json

This commit is contained in:
Iris Lightshard 2023-01-30 21:38:30 -07:00
parent d64fb026d9
commit 92a30dd9fc
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
11 changed files with 70 additions and 69 deletions

1
.gitignore vendored
View file

@ -1,5 +1,6 @@
felt felt
go.work go.work
go.work.sum
user.db user.db
mongodb/data/* mongodb/data/*
mongodb/.env mongodb/.env

View file

@ -4,14 +4,14 @@ import (
"encoding/json" "encoding/json"
"html/template" "html/template"
"net/http" "net/http"
"nilfm.cc/git/felt/admin/util" "hacklab.nilfm.cc/felt/admin/util"
"nilfm.cc/git/felt/models" "hacklab.nilfm.cc/felt/models"
"nilfm.cc/git/felt/mongodb" "hacklab.nilfm.cc/felt/mongodb"
"nilfm.cc/git/quartzgun/auth" "hacklab.nilfm.cc/quartzgun/auth"
. "nilfm.cc/git/quartzgun/middleware" . "hacklab.nilfm.cc/quartzgun/middleware"
"nilfm.cc/git/quartzgun/renderer" "hacklab.nilfm.cc/quartzgun/renderer"
"nilfm.cc/git/quartzgun/router" "hacklab.nilfm.cc/quartzgun/router"
. "nilfm.cc/git/quartzgun/util" . "hacklab.nilfm.cc/quartzgun/util"
) )
func apiGetTableList(next http.Handler, udb auth.UserStore) http.Handler { func apiGetTableList(next http.Handler, udb auth.UserStore) http.Handler {

View file

@ -3,8 +3,8 @@ package util
import ( import (
"encoding/base64" "encoding/base64"
"net/http" "net/http"
"nilfm.cc/git/felt/models" "hacklab.nilfm.cc/felt/models"
"nilfm.cc/git/quartzgun/auth" "hacklab.nilfm.cc/quartzgun/auth"
"strings" "strings"
) )

View file

@ -2,7 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"nilfm.cc/git/quartzgun/auth" "hacklab.nilfm.cc/quartzgun/auth"
"strings" "strings"
) )

View file

@ -8,12 +8,12 @@ import (
"log" "log"
"net/http" "net/http"
"nhooyr.io/websocket" "nhooyr.io/websocket"
"nilfm.cc/git/felt/admin" "hacklab.nilfm.cc/felt/admin"
"nilfm.cc/git/felt/models" "hacklab.nilfm.cc/felt/models"
"nilfm.cc/git/felt/mongodb" "hacklab.nilfm.cc/felt/mongodb"
"nilfm.cc/git/quartzgun/auth" "hacklab.nilfm.cc/quartzgun/auth"
"nilfm.cc/git/quartzgun/cookie" "hacklab.nilfm.cc/quartzgun/cookie"
"nilfm.cc/git/quartzgun/renderer" "hacklab.nilfm.cc/quartzgun/renderer"
"sync" "sync"
"time" "time"
) )

4
go.mod
View file

@ -1,12 +1,12 @@
module nilfm.cc/git/felt module hacklab.nilfm.cc/felt
go 1.19 go 1.19
require ( require (
go.mongodb.org/mongo-driver v1.11.0 go.mongodb.org/mongo-driver v1.11.0
golang.org/x/time v0.1.0 golang.org/x/time v0.1.0
hacklab.nilfm.cc/quartzgun v0.3.0
nhooyr.io/websocket v1.8.7 nhooyr.io/websocket v1.8.7
nilfm.cc/git/quartzgun v0.2.1
) )
require ( require (

4
go.sum
View file

@ -103,7 +103,7 @@ gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
hacklab.nilfm.cc/quartzgun v0.3.0 h1:nOTZaKaKv7q+08Y5vghOIYoMO9g+FAYQUyHzcQP6jUU=
hacklab.nilfm.cc/quartzgun v0.3.0/go.mod h1:P6qK4HB0CD/xfyRq8wdEGevAPFDDmv0KCaESSvv93LU=
nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g=
nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nilfm.cc/git/quartzgun v0.2.1 h1:R2Mi07c+nzaZL+x0atPXBoPoOXvDiLKqi3lcl81T6BA=
nilfm.cc/git/quartzgun v0.2.1/go.mod h1:/DDvt1DtzNuUf3HHaP29WMei/kkdaRW+ySmEzybvVto=

View file

@ -5,9 +5,9 @@ import (
"log" "log"
"net" "net"
"net/http" "net/http"
"nilfm.cc/git/felt/gametable" "hacklab.nilfm.cc/felt/gametable"
"nilfm.cc/git/felt/mongodb" "hacklab.nilfm.cc/felt/mongodb"
"nilfm.cc/git/quartzgun/indentalUserDB" "hacklab.nilfm.cc/quartzgun/indentalUserDB"
"os" "os"
"os/signal" "os/signal"
"time" "time"

View file

@ -5,39 +5,39 @@ import (
) )
type TableKey struct { type TableKey struct {
Name string `json:name` Name string `json:"name"`
Passcode string `json:passcode` Passcode string `json:"passcode"`
} }
type DiceRoll struct { type DiceRoll struct {
Faces uint8 Faces uint8 `json:"faces"`
Roll []uint8 Roll []uint8 `json:"roll"`
Player string Player string `json:"player"`
Note string Note string `json:"note"`
Timestamp time.Time Timestamp time.Time `json:"timestamp"`
} }
type Token struct { type Token struct {
Id string Id string `json:"id"`
Name string Name string `json:"name"`
SpriteUri string SpriteUri string `json:"spriteUrl"`
X int X int `json:"x"`
Y int Y int `json:"y"`
} }
type Table struct { type Table struct {
Name string Name string `json:"name"`
Passcode string Passcode string `json:"passcode"`
MapImageUrl string MapImageUrl string `json:"mapImageUrl"`
DiceRolls []DiceRoll DiceRolls []DiceRoll `json:"diceRolls"`
Tokens []Token Tokens []Token `json:"tokens"`
AvailableTokens []Token AvailableTokens []Token `json:"availableTokens"`
AuxMessage string AuxMessage string `json:"auxMessage"`
} }
type TableMessage struct { type TableMessage struct {
Roll DiceRoll Roll DiceRoll `json:"roll"`
Token Token Token Token `json:"token"`
MapImg string MapImg string `json:"mapImg"`
AuxMsg string AuxMsg string `json:"auxMsg"`
} }

View file

@ -7,7 +7,7 @@ import (
"go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options" "go.mongodb.org/mongo-driver/mongo/options"
"nilfm.cc/git/felt/models" "hacklab.nilfm.cc/felt/models"
"time" "time"
) )

View file

@ -17,7 +17,7 @@ async function getTables() {
const tableList = await res.json(); const tableList = await res.json();
let tableListHTML = "<ul>\n"; let tableListHTML = "<ul>\n";
for (const t of tableList) { for (const t of tableList) {
tableListHTML += `<li><a href="#">${t.Name}</a></li>\n` tableListHTML += `<li><a href="#">${t.name}</a></li>\n`
} }
tableListHTML += "</ul>" tableListHTML += "</ul>"
adminZone.innerHTML = tableListHTML; adminZone.innerHTML = tableListHTML;