Skip to content

Commit

Permalink
Fix file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dogancelik committed Mar 2, 2019
1 parent 5defbf8 commit e4ac9bf
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"os"

"github.com/eiannone/keyboard"
"github.com/skratchdot/open-golang/open"
"github.com/pkg/browser"
"github.com/urfave/cli"
)

import . "github.com/tj/go-debug"
import . "github.com/visionmedia/go-debug"

var debug = Debug("imgops")

Expand Down Expand Up @@ -109,7 +109,7 @@ func cliSearch(c *cli.Context) error {
if c.Bool("return") {
fmt.Println(url)
} else {
open.Start(url)
browser.OpenURL(url)
}
}
}
Expand Down
20 changes: 18 additions & 2 deletions run
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

export COMMIT_HASH=`git rev-parse --short @`
export COMMIT_DATE=`git log -1 --pretty=format:%cI | sed -r -e 's/T.*//' -e 's/-//g'`
export BUILD_DIR="build/"

function PREBUILD {
go get ./...
Expand All @@ -21,7 +22,7 @@ function BUILD {
VERSION=${VERSION:-${CI_BUILD_TAG:-#${CI_BUILD_REF:0:6}}}
echo "Version: ${VERSION:-\$VERSION is empty}"

go build -ldflags "-X main.Version=$VERSION" -o $OUT_FILE
go build -ldflags "-X main.Version=$VERSION" -o "$BUILD_DIR$OUT_FILE"
}

function TEST {
Expand All @@ -44,8 +45,21 @@ function BUILDALL {
done
}

function ZIP {
cd `dirname $1`
ZIP_FILE=`basename $1 .exe`.zip
ADD_FILE=`basename $1`
7za a -tzip $ZIP_FILE $ADD_FILE > /dev/null 2>&1
echo SHA1: `sha1sum $ZIP_FILE`
}

function ZIPALL {
export -f ZIP
find $BUILD_DIR -iname "*" ! -iname "*.zip" -type f -exec bash -c 'ZIP "$1"' - {} \;
}

function HELP {
echo -e "ImgOps Build Tool\nCommands: prebuild, build, test, buildall, help"
echo -e "ImgOps Build Tool\nCommands: prebuild, build, test, buildall, zipall, help"
}

case $1 in
Expand All @@ -57,6 +71,8 @@ case $1 in
TEST ;;
buildall)
BUILDALL ;;
zipall)
ZIPALL ;;
*)
HELP ;;
esac
2 changes: 1 addition & 1 deletion upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/parnurzeal/gorequest"
)

const uploadUrl string = "https://imgops.com/upload/uploadPhoto-action.asp"
const uploadUrl string = "https://imgops.com/store"
const uploadSearch string = "userUploadTempCache"
const defaultTarget = "imgops"

Expand Down

0 comments on commit e4ac9bf

Please sign in to comment.