Skip to content

Commit

Permalink
Merge pull request root-gg#334 from camathieu/master
Browse files Browse the repository at this point in the history
1.3.1
  • Loading branch information
camathieu authored Oct 27, 2020
2 parents 1cfa6a8 + aecbdc8 commit a05ae36
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 3 deletions.
4 changes: 2 additions & 2 deletions releaser/releaser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ do

echo "################################################"
echo "Building Plik client for $TARGET to $CLIENT_PATH"
make client
make --no-print-directory client

mkdir -p "$CLIENT_DIR"
cp client/plik "$CLIENT_PATH"
Expand All @@ -74,7 +74,7 @@ mkdir -p releases/archives
function build_release {
echo "#################################"
echo "Building server for $GOOS $GOARCH"
make server
make --no-print-directory server

RELEASE="plik-$RELEASE_VERSION-$GOOS-$GOARCH"
RELEASE_DIR="releases/$RELEASE"
Expand Down
2 changes: 1 addition & 1 deletion server/common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Configuration struct {
UploadWhitelist []string `json:"-"`

Authentication bool `json:"authentication"`
NoAnonymousUploads bool `json:"-"`
NoAnonymousUploads bool `json:"noAnonymousUploads"`
OneShot bool `json:"oneShot"`
Removable bool `json:"removable"`
Stream bool `json:"stream"`
Expand Down
7 changes: 7 additions & 0 deletions webapp/js/ctrl/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,5 +224,12 @@ plik.controller('HomeCtrl', ['$scope', '$api', '$config', '$dialog', '$location'
return filesize(size, {base: 2});
};

// Redirect to main page
$scope.mainpage = function () {
$location.search({});
$location.hash("");
$location.path('/');
};

loadUser($config.getUser());
}]);
11 changes: 11 additions & 0 deletions webapp/js/ctrl/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ plik.controller('MainCtrl', ['$scope', '$api', '$config', '$route', '$location',
.then(function (config) {
$scope.config = config;
$scope.setDefaultTTL();
if ( config.noAnonymousUploads ) {
// Redirect to login page if user is not authenticated
$config.getUser()
.then(null, function (error) {
if (error.status === 401 || error.status === 403) {
$location.path('/login');
} else {
$dialog.alert(error);
}
});
}
})
.then(null, function (error) {
$dialog.alert(error);
Expand Down
8 changes: 8 additions & 0 deletions webapp/partials/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
<p>Total Size : {{humanReadableSize(user.stats.totalSize)}}</p>
</div>
</div>
<!-- UPLOAD FILE BUTTON -->
<div class="tile menu">
<div class="menu-item">
<button type="button" class="btn btn-lg btn-primary btn-block" ng-click="mainpage()">
<i class="fa fa-upload"></i> Upload files
</button>
</div>
</div>
<!-- LOGOUT BUTTON -->
<div class="tile menu">
<div class="menu-item">
Expand Down

0 comments on commit a05ae36

Please sign in to comment.