Skip to content

Commit

Permalink
Fix macOS incompatibility issues #2
Browse files Browse the repository at this point in the history
  • Loading branch information
hbollon committed Feb 21, 2021
1 parent b21712f commit 59e0d1a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ The bot configuration is very easy thanks to the different configuration menus i

### From release

1. Download and install [Java](https://java.com/fr/download/) (needed for Selenium webdriver) and add it to your path (on Windows)
1. Download and install [Java](https://java.com/fr/download/) and [Java JDK](https://www.oracle.com/fr/java/technologies/javase-jdk15-downloads.html) (needed for Selenium webdriver) and add them to your path (on Windows)
2. Download [lastest release](https://github.com/hbollon/igopher/releases/latest) executable for your operating system
3. Move the executable to a dedicated folder (it will create folders/files)
4. Launch it:
- On Windows, open a **Windows Terminal** in the folder (or powershell/cmd but the experience quality can be lower) and execute it: ```./tui.exe``` or just drag and drop tui.exe in your command prompt
- On Linux, open you favorite shell in the folder and execute it: ```./tui```
- On Linux or MacOS, open you favorite shell in the folder, allow it to be executed with ```chmod +x ./tui``` and launch it: ```./tui```
5. Configure the bot with your Instagram credentials and set your desired scrapping and autodm settings. To do that, you can use the TUI settings screen or directly edit the config.yaml file.
6. You're ready! Just hit the "Launch" option in the TUI main menu 🚀

### From sources

1. Download and install [Java](https://java.com/fr/download/) (needed for Selenium webdriver) and add it to your path (on Windows)
1. Download and install [Java](https://java.com/fr/download/) and [Java JDK](https://www.oracle.com/fr/java/technologies/javase-jdk15-downloads.html) (needed for Selenium webdriver) and add them to your path (on Windows)
2. Install [Go](https://golang.org/doc/install) (v1.13+) on your system
3. Download [lastest release](https://github.com/hbollon/igopher/releases/latest) source archive or clone the master branch
4. Launch it with this command: ```go run ./cmd/igopher/tui```
Expand Down
21 changes: 21 additions & 0 deletions dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const (
desiredFirefoxVersion = "68.0.1"

windowsOs = "windows"
macOs = "darwin"
)

type file struct {
Expand Down Expand Up @@ -83,6 +84,14 @@ var (
os: windowsOs,
compressed: true,
},
{
url: "https://saucelabs.com/downloads/sc-4.6.3-osx.zip",
name: "sauce-connect.zip",
path: downloadDirectory + "sauce-connect.zip",
rename: []string{downloadDirectory + "sc-4.6.3-osx", downloadDirectory + "sauce-connect"},
os: macOs,
compressed: true,
},
}

downloadDirectory = filepath.FromSlash("./lib/")
Expand Down Expand Up @@ -147,6 +156,14 @@ func addChrome(ctx context.Context, latestChromeBuild string) error {
chromeDriverTargetFilename = "chromedriver.zip"
downloadDriverPath = filepath.FromSlash("chromedriver_win32/chromedriver.exe")
targetDriverPath = "chromedriver.exe"
} else if runtime.GOOS == macOs {
prefixOS = "Mac"
lastChangeFile = "Mac/LAST_CHANGE"
chromeFilename = "chrome-mac.zip"
chromeDriverFilename = "chromedriver_mac64.zip"
chromeDriverTargetFilename = "chromedriver.zip"
downloadDriverPath = filepath.FromSlash("chromedriver_mac64/chromedriver")
targetDriverPath = "chromedriver"
} else {
prefixOS = "Linux_x64"
lastChangeFile = "Linux_x64/LAST_CHANGE"
Expand Down Expand Up @@ -283,6 +300,10 @@ func DownloadDependencies(downloadBrowsers, downloadLatest, forceDl bool) {
if err := addLatestGithubRelease(ctx, "mozilla", "geckodriver", "geckodriver-.*win64.zip", "geckodriver.zip", true); err != nil {
log.Errorf("Unable to find the latest Geckodriver: %s", err)
}
} else if runtime.GOOS == macOs {
if err := addLatestGithubRelease(ctx, "mozilla", "geckodriver", "geckodriver-.*macos.tar.gz", "geckodriver.tar.gz", true); err != nil {
log.Errorf("Unable to find the latest Geckodriver: %s", err)
}
} else {
if err := addLatestGithubRelease(ctx, "mozilla", "geckodriver", "geckodriver-.*linux64.tar.gz", "geckodriver.tar.gz", true); err != nil {
log.Errorf("Unable to find the latest Geckodriver: %s", err)
Expand Down
4 changes: 4 additions & 0 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func init() {
geckoDriverPath = filepath.FromSlash("./lib/geckodriver.exe")
chromeDriverPath = filepath.FromSlash("./lib/chromedriver.exe")
chromePath = filepath.FromSlash("./lib/chrome-win/chrome.exe")
} else if runtime.GOOS == "darwin" {
geckoDriverPath = filepath.FromSlash("./lib/geckodriver")
chromeDriverPath = filepath.FromSlash("./lib/chromedriver")
chromePath = filepath.FromSlash("./lib/chrome-mac/Chromium.app/Contents/MacOS/Chromium")
} else {
geckoDriverPath = filepath.FromSlash("./lib/geckodriver")
chromeDriverPath = filepath.FromSlash("./lib/chromedriver")
Expand Down
1 change: 1 addition & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func init() {
cmd.Stdout = os.Stdout
cmd.Run()
}
clear["darwin"] = clear["linux"]
}

// Sleep random time between default sleepMin and sleepMax
Expand Down

0 comments on commit 59e0d1a

Please sign in to comment.