mirror of
https://github.com/m1k1o/neko.git
synced 2025-05-24 06:27:09 +02:00
http endpoints for transferring files
This commit is contained in:
parent
fa45619dbb
commit
1505abb703
4 changed files with 147 additions and 0 deletions
|
@ -12,6 +12,10 @@ type WebSocket struct {
|
|||
Locks []string
|
||||
|
||||
ControlProtection bool
|
||||
|
||||
FileTransfer bool
|
||||
UnprivFileTransfer bool
|
||||
FileTransferPath string
|
||||
}
|
||||
|
||||
func (WebSocket) Init(cmd *cobra.Command) error {
|
||||
|
@ -40,6 +44,21 @@ func (WebSocket) Init(cmd *cobra.Command) error {
|
|||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().Bool("file_transfer", false, "allow file transfer for admins")
|
||||
if err := viper.BindPFlag("file_transfer", cmd.PersistentFlags().Lookup("file_transfer")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().Bool("unpriv_file_transfer", false, "allow file transfer for non admins")
|
||||
if err := viper.BindPFlag("unpriv_file_transfer", cmd.PersistentFlags().Lookup("unpriv_file_transfer")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
cmd.PersistentFlags().String("file_transfer_path", "/home/neko/Downloads", "path to use for file transfer")
|
||||
if err := viper.BindPFlag("file_transfer_path", cmd.PersistentFlags().Lookup("file_transfer_path")); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -50,4 +69,8 @@ func (s *WebSocket) Set() {
|
|||
s.Locks = viper.GetStringSlice("locks")
|
||||
|
||||
s.ControlProtection = viper.GetBool("control_protection")
|
||||
|
||||
s.FileTransfer = viper.GetBool("file_transfer")
|
||||
s.UnprivFileTransfer = viper.GetBool("unpriv_file_transfer")
|
||||
s.FileTransferPath = viper.GetString("file_transfer_path")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue