image acces api : GWM
This commit is contained in:
parent
e61b684759
commit
eb4d576607
BIN
approve.png
Normal file
BIN
approve.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
28
main.go
28
main.go
@ -13,7 +13,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/mail"
|
"net/mail"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"pocketbase/utils"
|
"pocketbase/utils"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -587,6 +587,32 @@ func main() {
|
|||||||
|
|
||||||
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
app.OnBeforeServe().Add(func(e *core.ServeEvent) error {
|
||||||
|
|
||||||
|
e.Router.GET("/api/getImagePath", func(c echo.Context) error {
|
||||||
|
|
||||||
|
fileName := c.QueryParam("file")
|
||||||
|
if fileName == "" {
|
||||||
|
return c.JSON(http.StatusBadRequest, map[string]string{
|
||||||
|
"error": "missing file parameter",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Static files folder
|
||||||
|
staticPath := "./pb_public"
|
||||||
|
fullPath := filepath.Join(staticPath, fileName)
|
||||||
|
|
||||||
|
// Check if file exists
|
||||||
|
if _, err := os.Stat(fullPath); os.IsNotExist(err) {
|
||||||
|
return c.JSON(http.StatusNotFound, map[string]string{
|
||||||
|
"error": "file not found",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// Serve the file directly (browser will show the image)
|
||||||
|
return c.File(fullPath)
|
||||||
|
})
|
||||||
|
|
||||||
|
// e.Router.Static("/static", "./pb_public")
|
||||||
|
|
||||||
e.Router.GET("/pw/auth/confirm-password-reset/:token", func(c echo.Context) error {
|
e.Router.GET("/pw/auth/confirm-password-reset/:token", func(c echo.Context) error {
|
||||||
return c.File("pb_public/confirm_password_reset.html")
|
return c.File("pb_public/confirm_password_reset.html")
|
||||||
})
|
})
|
||||||
|
|||||||
BIN
pb_data/data.db-shm
Executable file
BIN
pb_data/data.db-shm
Executable file
Binary file not shown.
0
pb_data/data.db-wal
Executable file
0
pb_data/data.db-wal
Executable file
BIN
pb_data/logs.db-shm
Normal file
BIN
pb_data/logs.db-shm
Normal file
Binary file not shown.
BIN
pb_data/logs.db-wal
Normal file
BIN
pb_data/logs.db-wal
Normal file
Binary file not shown.
BIN
pb_public/approve.png
Normal file
BIN
pb_public/approve.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 969 B |
BIN
pb_public/reject.png
Normal file
BIN
pb_public/reject.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 970 B |
BIN
reject.png
Normal file
BIN
reject.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 970 B |
Loading…
Reference in New Issue
Block a user