diff --git a/dist-specific-files/goTorrent.service b/dist-specific-files/goTorrent.service new file mode 100644 index 00000000..c8071177 --- /dev/null +++ b/dist-specific-files/goTorrent.service @@ -0,0 +1,13 @@ +[Unit] +Description=goTorrent Server +After=network.target + +[Service] +type=simple +User=goTorrent +WorkingDirectory=/opt/goTorrent +ExecStart=/opt/goTorrent/goTorrent +Restart=on-abort + +[Install] +WantedBy=multi-user.target diff --git a/engine/doneTorrentActions.go b/engine/doneTorrentActions.go index 9e49c881..3dcd58ff 100644 --- a/engine/doneTorrentActions.go +++ b/engine/doneTorrentActions.go @@ -67,7 +67,9 @@ func MoveAndLeaveSymlink(config FullClientSettings, singleTorrent *torrent.Torre Logger.WithFields(logrus.Fields{"Old File Path": oldFilePath, "New File Path": newFilePath, "bytesWritten": bytesWritten}).Info("Windows Torrent Copy Completed") notifyUser(tStorage, config, singleTorrent, db) } else { - err := os.Symlink(oldFilePath, newFilePath) //For all other OS's create a symlink + folderCopy.Copy(oldFilePath, newFilePath) + os.RemoveAll(oldFilePath) + err := os.Symlink(newFilePath, oldFilePath) //For all other OS's create a symlink if err != nil { Logger.WithFields(logrus.Fields{"Old File Path": oldFilePath, "New File Path": newFilePath, "error": err}).Error("Error creating symlink") return diff --git a/goTorrentWebUI/src/TopMenu/Modals/addTorrentFileModal.js b/goTorrentWebUI/src/TopMenu/Modals/addTorrentFileModal.js index 597c01a2..e59c4e9c 100644 --- a/goTorrentWebUI/src/TopMenu/Modals/addTorrentFileModal.js +++ b/goTorrentWebUI/src/TopMenu/Modals/addTorrentFileModal.js @@ -57,9 +57,7 @@ export default class addTorrentFilePopup extends React.Component { }; handleSubmit = () => { - this.setState({ open: false }); - //let magnetLinkSubmit = this.state.textValue; - console.log("File", this.state.torrentFileValue) + this.setState({open: false}) const reader = new FileReader() let torrentFileBlob = new Blob(this.state.torrentFileValue) console.log("Blob", torrentFileBlob) @@ -76,6 +74,7 @@ export default class addTorrentFilePopup extends React.Component { } console.log("Sending magnet link: ", torrentFileMessage); ws.send(JSON.stringify(torrentFileMessage)); + this.setState({torrentFileName: "", storageValue: "", torrentFileValue: [], showDrop: true}) } } diff --git a/main.go b/main.go index fe91cb3d..773720fa 100644 --- a/main.go +++ b/main.go @@ -60,14 +60,22 @@ func main() { Storage.Logger = Logger Config := Engine.FullClientSettingsNew() //grabbing from settings.go if Config.LoggingOutput == "file" { - os.Remove("logs/server.log") //cleanup the old log on every restart - file, err := os.OpenFile("logs/server.log", os.O_CREATE|os.O_WRONLY, 0666) //creating the log file - defer file.Close() //TODO.. since we write to this constantly how does close work? - if err != nil { - fmt.Println("Unable to create file for logging.... please check permissions.. forcing output to stdout") - Logger.Out = os.Stdout + _, err := os.Stat("logs/server.log") + if os.IsNotExist(err) { + err := os.Mkdir("logs", 0644) + if err != nil { + fmt.Println("Unable to create 'log' folder for logging.... please check permissions.. forcing output to stdout") + } + } else { + os.Remove("logs/server.log") //cleanup the old log on every restart + file, err := os.OpenFile("logs/server.log", os.O_CREATE|os.O_WRONLY, 0666) //creating the log file + defer file.Close() //TODO.. since we write to this constantly how does close work? + if err != nil { + fmt.Println("Unable to create file for logging.... please check permissions.. forcing output to stdout") + Logger.Out = os.Stdout + } + Logger.Out = file } - Logger.Out = file //Setting our logger to output to the file } else { Logger.Out = os.Stdout } diff --git a/public/static/js/bundle.js b/public/static/js/bundle.js index 356d9e80..8886ab5c 100644 --- a/public/static/js/bundle.js +++ b/public/static/js/bundle.js @@ -93510,8 +93510,6 @@ var addTorrentFilePopup = function (_React$Component) { _this.setState({ open: false }); }, _this.handleSubmit = function () { _this.setState({ open: false }); - //let magnetLinkSubmit = this.state.textValue; - console.log("File", _this.state.torrentFileValue); var reader = new FileReader(); var torrentFileBlob = new Blob(_this.state.torrentFileValue); console.log("Blob", torrentFileBlob); @@ -93528,6 +93526,7 @@ var addTorrentFilePopup = function (_React$Component) { }; console.log("Sending magnet link: ", torrentFileMessage); ws.send(JSON.stringify(torrentFileMessage)); + _this.setState({ torrentFileName: "", storageValue: "", torrentFileValue: [], showDrop: true }); }; }, _this.onFileLoad = function (file) { _this.setState({ torrentFileName: file[0].name });