mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
rename module to full github path. (#53)
This commit is contained in:
@@ -5,13 +5,13 @@ import (
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"m1k1o/neko_rooms"
|
||||
"m1k1o/neko_rooms/cmd"
|
||||
"m1k1o/neko_rooms/internal/utils"
|
||||
nekoRooms "github.com/m1k1o/neko-rooms"
|
||||
"github.com/m1k1o/neko-rooms/cmd"
|
||||
"github.com/m1k1o/neko-rooms/internal/utils"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Print(utils.Colorf(neko_rooms.Header, "server", neko_rooms.Service.Version))
|
||||
fmt.Print(utils.Colorf(nekoRooms.Header, "server", nekoRooms.Service.Version))
|
||||
if err := cmd.Execute(); err != nil {
|
||||
log.Panic().Err(err).Msg("failed to execute command")
|
||||
}
|
||||
|
||||
+13
-8
@@ -15,7 +15,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/viper"
|
||||
|
||||
"m1k1o/neko_rooms"
|
||||
nekoRooms "github.com/m1k1o/neko-rooms"
|
||||
)
|
||||
|
||||
func Execute() error {
|
||||
@@ -23,10 +23,10 @@ func Execute() error {
|
||||
}
|
||||
|
||||
var root = &cobra.Command{
|
||||
Use: "neko_rooms",
|
||||
Short: "neko_rooms server",
|
||||
Long: `neko_rooms server`,
|
||||
Version: neko_rooms.Service.Version.String(),
|
||||
Use: "neko-rooms",
|
||||
Short: "neko-rooms server",
|
||||
Long: `neko-rooms server`,
|
||||
Version: nekoRooms.Service.Version.String(),
|
||||
}
|
||||
|
||||
func init() {
|
||||
@@ -49,6 +49,7 @@ func init() {
|
||||
|
||||
logs := filepath.Join(".", "logs")
|
||||
if runtime.GOOS == "linux" {
|
||||
// TODO: Change to neko-rooms.
|
||||
logs = "/var/log/neko_rooms"
|
||||
}
|
||||
|
||||
@@ -56,9 +57,11 @@ func init() {
|
||||
os.Mkdir(logs, os.ModePerm)
|
||||
}
|
||||
|
||||
// TODO: Change to neko-rooms.
|
||||
latest := filepath.Join(logs, "neko_rooms-latest.log")
|
||||
_, err := os.Stat(latest)
|
||||
if err == nil {
|
||||
// TODO: Change to neko-rooms.
|
||||
err = os.Rename(latest, filepath.Join(logs, "neko_rooms."+time.Now().Format("2006-01-02T15-04-05Z07-00")+".log"))
|
||||
if err != nil {
|
||||
log.Panic().Err(err).Msg("failed to rotate log file")
|
||||
@@ -85,10 +88,12 @@ func init() {
|
||||
viper.SetConfigFile(config) // Use config file from the flag.
|
||||
} else {
|
||||
if runtime.GOOS == "linux" {
|
||||
// TODO: Change to neko-rooms.
|
||||
viper.AddConfigPath("/etc/neko_rooms/")
|
||||
}
|
||||
|
||||
viper.AddConfigPath(".")
|
||||
// TODO: Change to config.
|
||||
viper.SetConfigName("neko_rooms")
|
||||
}
|
||||
|
||||
@@ -118,12 +123,12 @@ func init() {
|
||||
logger.Info().Msg("preflight complete")
|
||||
}
|
||||
|
||||
neko_rooms.Service.Configs.Root.Set()
|
||||
nekoRooms.Service.Configs.Root.Set()
|
||||
})
|
||||
|
||||
if err := neko_rooms.Service.Configs.Root.Init(root); err != nil {
|
||||
if err := nekoRooms.Service.Configs.Root.Init(root); err != nil {
|
||||
log.Panic().Err(err).Msg("unable to run root command")
|
||||
}
|
||||
|
||||
root.SetVersionTemplate(neko_rooms.Service.Version.Details())
|
||||
root.SetVersionTemplate(nekoRooms.Service.Version.Details())
|
||||
}
|
||||
|
||||
+9
-9
@@ -4,29 +4,29 @@ import (
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"m1k1o/neko_rooms"
|
||||
"m1k1o/neko_rooms/internal/config"
|
||||
nekoRooms "github.com/m1k1o/neko-rooms"
|
||||
"github.com/m1k1o/neko-rooms/internal/config"
|
||||
)
|
||||
|
||||
func init() {
|
||||
command := &cobra.Command{
|
||||
Use: "serve",
|
||||
Short: "serve neko_rooms server",
|
||||
Long: `serve neko_rooms server`,
|
||||
Run: neko_rooms.Service.ServeCommand,
|
||||
Short: "serve neko-rooms server",
|
||||
Long: `serve neko-rooms server`,
|
||||
Run: nekoRooms.Service.ServeCommand,
|
||||
}
|
||||
|
||||
configs := []config.Config{
|
||||
neko_rooms.Service.Configs.Server,
|
||||
neko_rooms.Service.Configs.API,
|
||||
neko_rooms.Service.Configs.Room,
|
||||
nekoRooms.Service.Configs.Server,
|
||||
nekoRooms.Service.Configs.API,
|
||||
nekoRooms.Service.Configs.Room,
|
||||
}
|
||||
|
||||
cobra.OnInitialize(func() {
|
||||
for _, cfg := range configs {
|
||||
cfg.Set()
|
||||
}
|
||||
neko_rooms.Service.Preflight()
|
||||
nekoRooms.Service.Preflight()
|
||||
})
|
||||
|
||||
for _, cfg := range configs {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
module m1k1o/neko_rooms
|
||||
module github.com/m1k1o/neko-rooms
|
||||
|
||||
go 1.17
|
||||
|
||||
|
||||
+2
-2
@@ -5,8 +5,8 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"m1k1o/neko_rooms/internal/config"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/config"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
type ApiManagerCtx struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"m1k1o/neko_rooms/internal/utils"
|
||||
"github.com/m1k1o/neko-rooms/internal/utils"
|
||||
)
|
||||
|
||||
func (manager *ApiManagerCtx) RoomLobby(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func (manager *ApiManagerCtx) pullStart(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func (manager *ApiManagerCtx) roomsList(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -12,8 +12,8 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"m1k1o/neko_rooms/internal/config"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/config"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
type HttpManagerCtx struct {
|
||||
|
||||
@@ -6,7 +6,8 @@ import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
//go:embed policies.json
|
||||
|
||||
@@ -4,8 +4,9 @@ package chromium
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"strings"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
|
||||
@@ -2,9 +2,10 @@ package policies
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"m1k1o/neko_rooms/internal/policies/chromium"
|
||||
"m1k1o/neko_rooms/internal/policies/firefox"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/policies/chromium"
|
||||
"github.com/m1k1o/neko-rooms/internal/policies/firefox"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func Generate(policies types.BrowserPolicyContent, policyType types.BrowserPolicyType) (string, error) {
|
||||
|
||||
@@ -5,7 +5,8 @@ package firefox
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
//go:embed policies.json
|
||||
|
||||
@@ -5,7 +5,8 @@ package firefox
|
||||
import (
|
||||
_ "embed"
|
||||
"encoding/json"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func Parse(policiesJson string) (*types.BrowserPolicyContent, error) {
|
||||
|
||||
@@ -9,7 +9,7 @@ import (
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
func (manager *RoomManagerCtx) containerToEntry(container dockerTypes.Container) (*types.RoomEntry, error) {
|
||||
|
||||
@@ -4,7 +4,7 @@ import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
)
|
||||
|
||||
type RoomLabels struct {
|
||||
|
||||
@@ -20,10 +20,10 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"m1k1o/neko_rooms/internal/config"
|
||||
"m1k1o/neko_rooms/internal/policies"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"m1k1o/neko_rooms/internal/utils"
|
||||
"github.com/m1k1o/neko-rooms/internal/config"
|
||||
"github.com/m1k1o/neko-rooms/internal/policies"
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -6,12 +6,13 @@ import (
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"m1k1o/neko_rooms/internal/types"
|
||||
"m1k1o/neko_rooms/internal/utils"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
dockerTypes "github.com/docker/docker/api/types"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/types"
|
||||
"github.com/m1k1o/neko-rooms/internal/utils"
|
||||
)
|
||||
|
||||
type PullConfig struct {
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"m1k1o/neko_rooms/internal/utils"
|
||||
"github.com/m1k1o/neko-rooms/internal/utils"
|
||||
)
|
||||
|
||||
var blacklistedEnvs = []string{
|
||||
|
||||
@@ -6,14 +6,14 @@ import (
|
||||
"os/signal"
|
||||
"runtime"
|
||||
|
||||
"m1k1o/neko_rooms/internal/api"
|
||||
"m1k1o/neko_rooms/internal/config"
|
||||
"m1k1o/neko_rooms/internal/http"
|
||||
"m1k1o/neko_rooms/internal/room"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"github.com/m1k1o/neko-rooms/internal/api"
|
||||
"github.com/m1k1o/neko-rooms/internal/config"
|
||||
"github.com/m1k1o/neko-rooms/internal/http"
|
||||
"github.com/m1k1o/neko-rooms/internal/room"
|
||||
)
|
||||
|
||||
const Header = `&34
|
||||
|
||||
Reference in New Issue
Block a user