mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
format Go source code.
This commit is contained in:
parent
732764991b
commit
45679f1b86
@ -5,8 +5,8 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
"demodesk/neko"
|
||||
"demodesk/neko/modules"
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/modules"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -3,8 +3,8 @@ package members
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
type MemberDataPayload struct {
|
||||
|
@ -6,9 +6,9 @@ import (
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"demodesk/neko/internal/http/auth"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/http/auth"
|
||||
)
|
||||
|
||||
type key int
|
||||
|
@ -3,9 +3,9 @@ package room
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
type BroadcastStatusPayload struct {
|
||||
|
@ -6,8 +6,8 @@ import (
|
||||
//"strings"
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
type ClipboardPayload struct {
|
||||
|
@ -5,10 +5,10 @@ import (
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"demodesk/neko/internal/http/auth"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/http/auth"
|
||||
)
|
||||
|
||||
type ControlStatusPayload struct {
|
||||
|
@ -5,8 +5,8 @@ import (
|
||||
|
||||
"github.com/go-chi/chi"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/http/auth"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
|
@ -3,8 +3,8 @@ package room
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
type KeyboardMapData struct {
|
||||
@ -28,7 +28,7 @@ func (h *RoomHandler) keyboardMapSet(w http.ResponseWriter, r *http.Request) {
|
||||
Variant: data.Variant,
|
||||
})
|
||||
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, "Unable to change keyboard map.")
|
||||
return
|
||||
}
|
||||
@ -39,7 +39,7 @@ func (h *RoomHandler) keyboardMapSet(w http.ResponseWriter, r *http.Request) {
|
||||
func (h *RoomHandler) keyboardMapGet(w http.ResponseWriter, r *http.Request) {
|
||||
data, err := h.desktop.GetKeyboardMap()
|
||||
|
||||
if err != nil{
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, "Unable to get keyboard map.")
|
||||
return
|
||||
}
|
||||
|
@ -3,8 +3,8 @@ package room
|
||||
import (
|
||||
"bytes"
|
||||
"image/jpeg"
|
||||
"strconv"
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/event"
|
||||
|
@ -1,12 +1,12 @@
|
||||
package room
|
||||
|
||||
import (
|
||||
"os"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
"net/http"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
@ -62,7 +62,7 @@ func (h *RoomHandler) uploadDrop(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
defer srcFile.Close()
|
||||
|
||||
dstFile, err := os.OpenFile(path, os.O_APPEND | os.O_CREATE | os.O_WRONLY, 0644)
|
||||
dstFile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
@ -125,7 +125,7 @@ func (h *RoomHandler) uploadDialogPost(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
defer srcFile.Close()
|
||||
|
||||
dstFile, err := os.OpenFile(path, os.O_APPEND | os.O_CREATE | os.O_WRONLY, 0644)
|
||||
dstFile, err := os.OpenFile(path, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
|
||||
if err != nil {
|
||||
utils.HttpInternalServerError(w, err)
|
||||
return
|
||||
|
@ -7,10 +7,10 @@ import (
|
||||
|
||||
"demodesk/neko/internal/api/members"
|
||||
"demodesk/neko/internal/api/room"
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/http/auth"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/config"
|
||||
)
|
||||
|
||||
type ApiManagerCtx struct {
|
||||
|
@ -1,12 +1,12 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"time"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"demodesk/neko/internal/utils"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/http/auth"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
type SessionLoginPayload struct {
|
||||
|
@ -2,8 +2,8 @@ package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -8,8 +8,8 @@ package gst
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"sync"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
|
@ -7,9 +7,9 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/codec"
|
||||
"demodesk/neko/internal/config"
|
||||
)
|
||||
|
||||
type CaptureManagerCtx struct {
|
||||
@ -29,18 +29,18 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
broadcastPipeline := config.BroadcastPipeline
|
||||
if broadcastPipeline == "" {
|
||||
broadcastPipeline = fmt.Sprintf(
|
||||
"flvmux name=mux ! rtmpsink location='{url} live=1' " +
|
||||
"pulsesrc device=%s " +
|
||||
"! audio/x-raw,channels=2 " +
|
||||
"! audioconvert " +
|
||||
"! queue " +
|
||||
"! voaacenc " +
|
||||
"! mux. " +
|
||||
"ximagesrc display-name=%s show-pointer=true use-damage=false " +
|
||||
"! video/x-raw " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! x264enc threads=4 bitrate=4096 key-int-max=15 byte-stream=true byte-stream=true tune=zerolatency speed-preset=veryfast " +
|
||||
"flvmux name=mux ! rtmpsink location='{url} live=1' "+
|
||||
"pulsesrc device=%s "+
|
||||
"! audio/x-raw,channels=2 "+
|
||||
"! audioconvert "+
|
||||
"! queue "+
|
||||
"! voaacenc "+
|
||||
"! mux. "+
|
||||
"ximagesrc display-name=%s show-pointer=true use-damage=false "+
|
||||
"! video/x-raw "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! x264enc threads=4 bitrate=4096 key-int-max=15 byte-stream=true byte-stream=true tune=zerolatency speed-preset=veryfast "+
|
||||
"! mux.", config.Device, config.Display,
|
||||
)
|
||||
}
|
||||
@ -48,11 +48,11 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
screencastPipeline := config.ScreencastPipeline
|
||||
if screencastPipeline == "" {
|
||||
screencastPipeline = fmt.Sprintf(
|
||||
"ximagesrc display-name=%s show-pointer=true use-damage=false " +
|
||||
"! video/x-raw,framerate=%s " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! jpegenc quality=%s " +
|
||||
"ximagesrc display-name=%s show-pointer=true use-damage=false "+
|
||||
"! video/x-raw,framerate=%s "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! jpegenc quality=%s "+
|
||||
"! appsink name=appsink", config.Display, config.ScreencastRate, config.ScreencastQuality,
|
||||
)
|
||||
}
|
||||
@ -69,11 +69,11 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"pulsesrc device=%s " +
|
||||
"! audio/x-raw,channels=2 " +
|
||||
"! audioconvert " +
|
||||
"! queue " +
|
||||
"! %s " +
|
||||
"pulsesrc device=%s "+
|
||||
"! audio/x-raw,channels=2 "+
|
||||
"! audioconvert "+
|
||||
"! queue "+
|
||||
"! %s "+
|
||||
"! appsink name=appsink", config.Device, config.AudioCodec.Pipeline,
|
||||
)
|
||||
}),
|
||||
@ -83,70 +83,70 @@ func New(desktop types.DesktopManager, config *config.Capture) *CaptureManagerCt
|
||||
bitrate := screen.Width * screen.Height * 12
|
||||
|
||||
return fmt.Sprintf(
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false " +
|
||||
"! video/x-raw,framerate=25/1 " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=6 max-quantizer=12 " +
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false "+
|
||||
"! video/x-raw,framerate=25/1 "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=6 max-quantizer=12 "+
|
||||
"! appsink name=appsink", config.Display, bitrate,
|
||||
)
|
||||
}),
|
||||
"hq": streamNew(codec.VP8(), func() string {
|
||||
screen := desktop.GetScreenSize()
|
||||
width := int(math.Ceil(float64(screen.Width) / 6) * 5)
|
||||
height := int(math.Ceil(float64(screen.Height) / 6) * 5)
|
||||
width := int(math.Ceil(float64(screen.Width)/6) * 5)
|
||||
height := int(math.Ceil(float64(screen.Height)/6) * 5)
|
||||
bitrate := width * height * 12
|
||||
|
||||
return fmt.Sprintf(
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false " +
|
||||
"! video/x-raw,framerate=25/1 " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! videoscale " +
|
||||
"! video/x-raw,width=%d,height=%d " +
|
||||
"! queue " +
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=6 max-quantizer=12 " +
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false "+
|
||||
"! video/x-raw,framerate=25/1 "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! videoscale "+
|
||||
"! video/x-raw,width=%d,height=%d "+
|
||||
"! queue "+
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=6 max-quantizer=12 "+
|
||||
"! appsink name=appsink", config.Display, width, height, bitrate,
|
||||
)
|
||||
}),
|
||||
"mq": streamNew(codec.VP8(), func() string {
|
||||
screen := desktop.GetScreenSize()
|
||||
width := int(math.Ceil(float64(screen.Width) / 6) * 4)
|
||||
height := int(math.Ceil(float64(screen.Height) / 6) * 4)
|
||||
width := int(math.Ceil(float64(screen.Width)/6) * 4)
|
||||
height := int(math.Ceil(float64(screen.Height)/6) * 4)
|
||||
bitrate := width * height * 8
|
||||
|
||||
return fmt.Sprintf(
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false " +
|
||||
"! video/x-raw,framerate=125/10 " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! videoscale " +
|
||||
"! video/x-raw,width=%d,height=%d " +
|
||||
"! queue " +
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=12 max-quantizer=24 " +
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false "+
|
||||
"! video/x-raw,framerate=125/10 "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! videoscale "+
|
||||
"! video/x-raw,width=%d,height=%d "+
|
||||
"! queue "+
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=12 max-quantizer=24 "+
|
||||
"! appsink name=appsink", config.Display, width, height, bitrate,
|
||||
)
|
||||
}),
|
||||
"lq": streamNew(codec.VP8(), func() string {
|
||||
screen := desktop.GetScreenSize()
|
||||
width := int(math.Ceil(float64(screen.Width) / 6) * 3)
|
||||
height := int(math.Ceil(float64(screen.Height) / 6) * 3)
|
||||
width := int(math.Ceil(float64(screen.Width)/6) * 3)
|
||||
height := int(math.Ceil(float64(screen.Height)/6) * 3)
|
||||
bitrate := width * height * 4
|
||||
|
||||
return fmt.Sprintf(
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false " +
|
||||
"! video/x-raw,framerate=125/10 " +
|
||||
"! videoconvert " +
|
||||
"! queue " +
|
||||
"! videoscale " +
|
||||
"! video/x-raw,width=%d,height=%d " +
|
||||
"! queue " +
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=12 max-quantizer=24 " +
|
||||
"ximagesrc display-name=%s show-pointer=false use-damage=false "+
|
||||
"! video/x-raw,framerate=125/10 "+
|
||||
"! videoconvert "+
|
||||
"! queue "+
|
||||
"! videoscale "+
|
||||
"! video/x-raw,width=%d,height=%d "+
|
||||
"! queue "+
|
||||
"! vp8enc target-bitrate=%d cpu-used=16 threads=4 deadline=100000 error-resilient=partitions keyframe-max-dist=15 auto-alt-ref=true min-quantizer=12 max-quantizer=24 "+
|
||||
"! appsink name=appsink", config.Display, width, height, bitrate,
|
||||
)
|
||||
}),
|
||||
},
|
||||
videoIDs: []string{ "hd", "hq", "mq", "lq" },
|
||||
videoIDs: []string{"hd", "hq", "mq", "lq"},
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,15 @@ package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"sync"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/capture/gst"
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
type ScreencastManagerCtx struct {
|
||||
@ -146,7 +146,7 @@ func (manager *ScreencastManagerCtx) createPipeline() error {
|
||||
|
||||
manager.pipeline.Start()
|
||||
manager.sample = manager.pipeline.Sample
|
||||
manager.emitUpdate <-true
|
||||
manager.emitUpdate <- true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -2,15 +2,15 @@ package capture
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/capture/gst"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/codec"
|
||||
"demodesk/neko/internal/capture/gst"
|
||||
)
|
||||
|
||||
type StreamManagerCtx struct {
|
||||
@ -146,7 +146,7 @@ func (manager *StreamManagerCtx) createPipeline() error {
|
||||
manager.pipeline.Start()
|
||||
|
||||
manager.sample = manager.pipeline.Sample
|
||||
manager.emitUpdate <-true
|
||||
manager.emitUpdate <- true
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
package desktop
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
|
@ -49,10 +49,10 @@ func (manager *DesktopManagerCtx) DropFiles(x int, y int, files []string) bool {
|
||||
go drop.OpenWindow(files)
|
||||
|
||||
select {
|
||||
case succeeded := <- finished:
|
||||
case succeeded := <-finished:
|
||||
return succeeded
|
||||
case <-time.After(1 * time.Second):
|
||||
drop.CloseWindow();
|
||||
drop.CloseWindow()
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ func OpenWindow(files []string) {
|
||||
defer mu.Unlock()
|
||||
|
||||
size := C.int(len(files))
|
||||
urisUnsafe := C.dragUrisMake(size);
|
||||
urisUnsafe := C.dragUrisMake(size)
|
||||
defer C.dragUrisFree(urisUnsafe, size)
|
||||
|
||||
for i, file := range files {
|
||||
|
@ -2,8 +2,8 @@ package desktop
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"os/exec"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -22,7 +22,7 @@ func (manager *DesktopManagerCtx) HandleFileChooserDialog(uri string) error {
|
||||
"search", "--name", FILE_CHOOSER_DIALOG_NAME, "windowfocus",
|
||||
"sleep", FILE_CHOOSER_DIALOG_SHORT_SLEEP,
|
||||
"key", "--clearmodifiers", "ctrl+l",
|
||||
"type", "--args", "1", uri + "//",
|
||||
"type", "--args", "1", uri+"//",
|
||||
"sleep", FILE_CHOOSER_DIALOG_SHORT_SLEEP,
|
||||
"key", "Delete", // remove autocomplete results
|
||||
"sleep", FILE_CHOOSER_DIALOG_SHORT_SLEEP,
|
||||
|
@ -2,16 +2,16 @@ package desktop
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/kataras/go-events"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/desktop/xorg"
|
||||
"demodesk/neko/internal/desktop/xevent"
|
||||
"demodesk/neko/internal/desktop/xorg"
|
||||
)
|
||||
|
||||
var mu = sync.Mutex{}
|
||||
|
@ -8,9 +8,9 @@ package xevent
|
||||
import "C"
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
"unsafe"
|
||||
"strings"
|
||||
|
||||
"github.com/kataras/go-events"
|
||||
)
|
||||
|
@ -2,11 +2,11 @@ package desktop
|
||||
|
||||
import (
|
||||
"image"
|
||||
"regexp"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/desktop/xorg"
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
// TODO: Refactor.
|
||||
|
@ -242,7 +242,7 @@ func GetCursorImage() *types.CursorImage {
|
||||
Yhot: uint16(cur.yhot),
|
||||
Serial: uint64(cur.cursor_serial),
|
||||
// Xlib stores 32-bit data in longs, even if longs are 64-bits long.
|
||||
Pixels: C.GoBytes(unsafe.Pointer(cur.pixels), C.int(width * height * 8)),
|
||||
Pixels: C.GoBytes(unsafe.Pointer(cur.pixels), C.int(width*height*8)),
|
||||
}
|
||||
}
|
||||
|
||||
@ -252,7 +252,7 @@ func GetScreenshotImage() *image.RGBA {
|
||||
|
||||
var w, h C.int
|
||||
pixelsUnsafe := C.XGetScreenshot(&w, &h)
|
||||
pixels := C.GoBytes(unsafe.Pointer(pixelsUnsafe), w * h * 3)
|
||||
pixels := C.GoBytes(unsafe.Pointer(pixelsUnsafe), w*h*3)
|
||||
defer C.free(unsafe.Pointer(pixelsUnsafe))
|
||||
|
||||
width := int(w)
|
||||
@ -288,7 +288,7 @@ func goSetScreenRates(index C.int, rate_index C.int, rateC C.short) {
|
||||
rate := int16(rateC)
|
||||
|
||||
// filter out all irrelevant rates
|
||||
if rate > 60 || (rate > 30 && rate % 10 != 0){
|
||||
if rate > 60 || (rate > 30 && rate%10 != 0) {
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,8 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
|
@ -8,7 +8,7 @@ func New() types.MembersDatabase {
|
||||
return &MembersDatabaseCtx{}
|
||||
}
|
||||
|
||||
type MembersDatabaseCtx struct {}
|
||||
type MembersDatabaseCtx struct{}
|
||||
|
||||
func (manager *MembersDatabaseCtx) Connect() error {
|
||||
return nil
|
||||
|
@ -2,9 +2,9 @@ package file
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
|
@ -1,11 +1,11 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/session/database/dummy"
|
||||
"demodesk/neko/internal/session/database/file"
|
||||
"demodesk/neko/internal/session/database/object"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/config"
|
||||
)
|
||||
|
||||
func New(config *config.Session) types.MembersDatabase {
|
||||
|
@ -8,9 +8,9 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/session/database"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/utils"
|
||||
)
|
||||
|
||||
|
@ -2,10 +2,10 @@ package utils
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"image"
|
||||
"image/color"
|
||||
"image/png"
|
||||
"encoding/base64"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
@ -1,10 +1,10 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"io"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
)
|
||||
|
||||
type nulllog struct {}
|
||||
type nulllog struct{}
|
||||
|
||||
func (l nulllog) Trace(msg string) {}
|
||||
func (l nulllog) Tracef(format string, args ...interface{}) {}
|
||||
|
@ -3,18 +3,18 @@ package webrtc
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
"github.com/pion/webrtc/v3/pkg/media"
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
"demodesk/neko/internal/config"
|
||||
)
|
||||
|
||||
func New(desktop types.DesktopManager, capture types.CaptureManager, config *config.WebRTC) *WebRTCManagerCtx {
|
||||
@ -58,7 +58,7 @@ func (manager *WebRTCManagerCtx) Start() {
|
||||
}
|
||||
|
||||
audio.AddListener(&listener)
|
||||
manager.audioStop = func(){
|
||||
manager.audioStop = func() {
|
||||
audio.RemoveListener(&listener)
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
package webrtc
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/utils"
|
||||
|
@ -39,7 +39,6 @@ func (ws *WebSocketManagerCtx) fileChooserDialogEvents() {
|
||||
}, nil)
|
||||
})
|
||||
|
||||
|
||||
// when new user joins, and someone holds dialog, he shouldd be notified about it.
|
||||
ws.sessions.OnConnected(func(session types.Session) {
|
||||
if file_chooser_dialog_member == nil {
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"demodesk/neko/internal/types/message"
|
||||
)
|
||||
|
||||
|
||||
func (h *MessageHandlerCtx) keyboardMap(session types.Session, payload *message.KeyboardMap) error {
|
||||
if !session.IsHost() {
|
||||
h.logger.Debug().Str("id", session.ID()).Msg("is not the host")
|
||||
|
@ -2,8 +2,8 @@ package handler
|
||||
|
||||
import (
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/message"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
)
|
||||
|
||||
func (h *MessageHandlerCtx) sendUnicast(session types.Session, payload *message.SendUnicast) error {
|
||||
@ -28,6 +28,6 @@ func (h *MessageHandlerCtx) sendBroadcast(session types.Session, payload *messag
|
||||
Sender: session.ID(),
|
||||
Subject: payload.Subject,
|
||||
Body: payload.Body,
|
||||
}, []string{ session.ID() })
|
||||
}, []string{session.ID()})
|
||||
return nil
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ func (h *MessageHandlerCtx) SessionDeleted(session types.Session) error {
|
||||
message.MemberID{
|
||||
Event: event.MEMBER_DELETED,
|
||||
ID: session.ID(),
|
||||
}, nil);
|
||||
}, nil)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
"github.com/rs/zerolog"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
||||
"demodesk/neko/internal/websocket/handler"
|
||||
"demodesk/neko/internal/types"
|
||||
"demodesk/neko/internal/types/event"
|
||||
"demodesk/neko/internal/types/message"
|
||||
"demodesk/neko/internal/websocket/handler"
|
||||
)
|
||||
|
||||
func New(
|
||||
|
10
neko.go
10
neko.go
@ -6,14 +6,14 @@ import (
|
||||
"os/signal"
|
||||
"runtime"
|
||||
|
||||
"demodesk/neko/internal/api"
|
||||
"demodesk/neko/internal/capture"
|
||||
"demodesk/neko/internal/config"
|
||||
"demodesk/neko/internal/desktop"
|
||||
"demodesk/neko/internal/capture"
|
||||
"demodesk/neko/internal/webrtc"
|
||||
"demodesk/neko/internal/session"
|
||||
"demodesk/neko/internal/websocket"
|
||||
"demodesk/neko/internal/api"
|
||||
"demodesk/neko/internal/http"
|
||||
"demodesk/neko/internal/session"
|
||||
"demodesk/neko/internal/webrtc"
|
||||
"demodesk/neko/internal/websocket"
|
||||
"demodesk/neko/modules"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
Loading…
Reference in New Issue
Block a user