attempting to fix the symlink issue being the wrong direction, fixing the log folder not existing error
This commit is contained in:
13
dist-specific-files/goTorrent.service
Normal file
13
dist-specific-files/goTorrent.service
Normal file
@@ -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
|
@@ -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
|
||||
|
@@ -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})
|
||||
}
|
||||
}
|
||||
|
||||
|
22
main.go
22
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
|
||||
}
|
||||
|
@@ -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 });
|
||||
|
Reference in New Issue
Block a user