Update project structure and enhance frontend functionality
- Added a new AGENTS.md file to document the project structure and conventions. - Updated .gitignore to include node_modules and refined cursor rules. - Introduced new backend and frontend components for improved map interactions, including context menus and controls. - Enhanced API composables for better admin and authentication functionalities. - Refactored existing components for cleaner code and improved user experience. - Updated README.md to clarify production asset serving and user setup instructions.
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/andyleap/hnh-map/internal/app/store"
|
||||
"go.etcd.io/bbolt"
|
||||
)
|
||||
|
||||
@@ -35,7 +36,7 @@ type TileData struct {
|
||||
|
||||
func (a *App) GetTile(mapid int, c Coord, z int) (td *TileData) {
|
||||
a.db.View(func(tx *bbolt.Tx) error {
|
||||
tiles := tx.Bucket([]byte("tiles"))
|
||||
tiles := tx.Bucket(store.BucketTiles)
|
||||
if tiles == nil {
|
||||
return nil
|
||||
}
|
||||
@@ -59,7 +60,7 @@ func (a *App) GetTile(mapid int, c Coord, z int) (td *TileData) {
|
||||
|
||||
func (a *App) SaveTile(mapid int, c Coord, z int, f string, t int64) {
|
||||
a.db.Update(func(tx *bbolt.Tx) error {
|
||||
tiles, err := tx.CreateBucketIfNotExists([]byte("tiles"))
|
||||
tiles, err := tx.CreateBucketIfNotExists(store.BucketTiles)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -82,14 +83,14 @@ func (a *App) SaveTile(mapid int, c Coord, z int, f string, t int64) {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
a.gridUpdates.send(td)
|
||||
a.gridUpdates.Send(td)
|
||||
return zoom.Put([]byte(c.Name()), raw)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
func (a *App) reportMerge(from, to int, shift Coord) {
|
||||
a.mergeUpdates.send(&Merge{
|
||||
a.mergeUpdates.Send(&Merge{
|
||||
From: from,
|
||||
To: to,
|
||||
Shift: shift,
|
||||
@@ -121,13 +122,13 @@ func (a *App) watchGridUpdates(rw http.ResponseWriter, req *http.Request) {
|
||||
c := make(chan *TileData, 1000)
|
||||
mc := make(chan *Merge, 5)
|
||||
|
||||
a.gridUpdates.watch(c)
|
||||
a.mergeUpdates.watch(mc)
|
||||
a.gridUpdates.Watch(c)
|
||||
a.mergeUpdates.Watch(mc)
|
||||
|
||||
tileCache := make([]TileCache, 0, 100)
|
||||
|
||||
a.db.View(func(tx *bbolt.Tx) error {
|
||||
tiles := tx.Bucket([]byte("tiles"))
|
||||
tiles := tx.Bucket(store.BucketTiles)
|
||||
if tiles == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user