Permalink
Browse files

Fixed Saves/Dupes tab exploit

  • Loading branch information...
1 parent 9a0cffc commit 09d6938db2d126b8c5f7eb3e2ff73b23cfc606a0 @robotboy655 robotboy655 committed Dec 15, 2015
@@ -6,7 +6,7 @@ spawnmenu.AddCreationTab( "#spawnmenu.category.dupes", function()
HTML = vgui.Create( "DHTML" )
JS_Language( HTML )
- HTML:SetAllowLua( true )
+ JS_Workshop( HTML )
HTML:OpenURL( "asset://garrysmod/html/dupes.html" )
HTML:Call( "SetDupeSaveState( " .. tostring( DupeInClipboard ).. " );" )
@@ -5,7 +5,7 @@ spawnmenu.AddCreationTab( "#spawnmenu.category.saves", function()
HTML = vgui.Create( "DHTML" )
JS_Language( HTML )
- HTML:SetAllowLua( true )
+ JS_Workshop( HTML )
HTML:OpenURL( "asset://garrysmod/html/saves.html" )
HTML:Call( "SetMap( '" .. game.GetMap() .. "' );" )
@@ -4,11 +4,11 @@ var IS_SPAWN_MENU = true
var App = angular.module( 'CreationsApp', [ 'tranny' ] );
-App.config(function ( $routeProvider, $locationProvider )
+App.config( function ( $routeProvider, $locationProvider )
{
- $routeProvider.when('/', { templateUrl: 'template/creations/saves.html', controller: 'ControllerSaves' });
- $routeProvider.when('/saves/:Category/:MapName/', { templateUrl: 'template/creations/saves.html', controller: ControllerSaves });
- $routeProvider.when('/dupes/:Category/:MapName/', { templateUrl: 'template/creations/dupes.html', controller: ControllerDupes });
+ $routeProvider.when( '/', { templateUrl: 'template/creations/saves.html', controller: 'ControllerSaves' } );
+ $routeProvider.when( '/saves/:Category/:MapName/', { templateUrl: 'template/creations/saves.html', controller: ControllerSaves } );
+ $routeProvider.when( '/dupes/:Category/:MapName/', { templateUrl: 'template/creations/dupes.html', controller: ControllerDupes } );
} );
@@ -21,22 +21,20 @@ function UpdateDigest( scope, timeout )
{
scope.DigestUpdate = 0;
scope.$digest();
-
}, timeout )
}
//We already have a limitTo filter built-in to angular,
//let's make a startFrom filter
App.filter( 'startFrom', function ()
{
- return function ( input, start )
+ return function( input, start )
{
start = +start; //parse to int
return input.slice( start );
}
} );
-
var CreationScope = null;
var CreationLocation = null;
@@ -47,7 +45,7 @@ function CCreations( $scope, $timeout, $location )
CreationScope.DupeDisabled = "disabled";
- CreationScope.Categories =
+ CreationScope.Categories =
[
"trending",
"popular",
@@ -58,35 +56,34 @@ function CCreations( $scope, $timeout, $location )
"mine",
];
- $scope.IfElse = function ( b, a, c )
+ $scope.IfElse = function( b, a, c )
{
if ( b ) return a;
return c;
}
- $scope.OpenWorkshopFile = function (id)
+ $scope.OpenWorkshopFile = function( id )
{
if ( !id ) return;
- lua.Run("steamworks.ViewFile( %s )", String(id));
+ gmod.OpenWorkshopFile( id );
}
- $scope.SaveSave=function()
+ $scope.SaveSave = function()
{
- lua.Run("RunConsoleCommand( \"gm_save\", \"spawnmenu\" );");
+ gmod.SaveSave();
$scope.SaveDisabled = "disabled";
- $timeout(function()
+ $timeout( function()
{
$scope.SaveDisabled = "";
-
- },5000);
+ }, 5000 );
}
- $scope.SaveDupe = function()
+ $scope.SaveDupe = function()
{
$scope.DupeDisabled = "disabled";
- lua.Run("RunConsoleCommand( \"dupe_save\", \"spawnmenu\" );");
+ gmod.SaveDupe();
}
SetMap( 'gm_construct' );
@@ -103,7 +100,7 @@ function SetMap( mapname )
//
// Enable the dupe save button
//
-function SetDupeSaveState( b )
+function SetDupeSaveState( b )
{
CreationScope.DupeDisabled = b ? "" : "disabled";
UpdateDigest( CreationScope, 10 );
@@ -115,6 +112,6 @@ function SetDupeSaveState( b )
//
function ShowLocalDupes()
{
- CreationLocation.path( "/dupes/local/"+Math.random()+"/" ); // Lolz, hackz
+ CreationLocation.path( "/dupes/local/" + Math.random() + "/" ); // Lolz, hackz
CreationScope.$apply();
-}
+}
@@ -1,10 +1,10 @@
App = angular.module( 'CDupesApp', [ 'tranny' ] );
-App.config(function ( $routeProvider, $locationProvider )
+App.config( function ( $routeProvider, $locationProvider )
{
- $routeProvider.when('/', { templateUrl: 'template/creations/dupes.html' });
- $routeProvider.when('/list/:Category/:Tag/', { templateUrl: 'template/creations/dupes.html' });
+ $routeProvider.when( '/', { templateUrl: 'template/creations/dupes.html' } );
+ $routeProvider.when( '/list/:Category/:Tag/', { templateUrl: 'template/creations/dupes.html' } );
} );
var CreationScope = null;
@@ -17,7 +17,7 @@ function CDupes( $scope, $timeout, $location )
CreationScope.DupeDisabled = "disabled";
- CreationScope.Categories =
+ CreationScope.Categories =
[
"trending",
"popular",
@@ -47,34 +47,34 @@ function CDupes( $scope, $timeout, $location )
return c;
}
- $scope.OpenWorkshopFile = function (id)
+ $scope.OpenWorkshopFile = function( id )
{
if ( !id ) return;
- lua.Run("steamworks.ViewFile( %s )", String(id));
+ gmod.OpenWorkshopFile( id );
}
- $scope.SaveDupe = function()
+ $scope.SaveDupe = function()
{
$scope.DupeDisabled = "disabled";
- lua.Run("RunConsoleCommand( \"dupe_save\", \"spawnmenu\" );");
+ gmod.SaveDupe();
+ lua.Run( "RunConsoleCommand( \"dupe_save\", \"spawnmenu\" );" );
@comedinha
comedinha Dec 15, 2015 Contributor

SaveDupe and run function again?

@bmwalters
bmwalters Dec 15, 2015 Contributor

👍

@robotboy655
robotboy655 Dec 15, 2015 Collaborator

lua.Run won't do anything, but I removed it anyway.

}
}
//
// Enable the dupe save button
//
-function SetDupeSaveState( b )
+function SetDupeSaveState( b )
{
CreationScope.DupeDisabled = b ? "" : "disabled";
UpdateDigest( CreationScope, 10 );
}
-
//
// Show the local dupes (we've just saved)
//
function ShowLocalDupes()
{
CreationLocation.path( "/list/local//" ); // Lolz, hackz
CreationScope.$apply();
-}
+}
@@ -1,10 +1,10 @@
App = angular.module( 'CSavesApp', [ 'tranny' ] );
-App.config(function ( $routeProvider, $locationProvider )
+App.config( function ( $routeProvider, $locationProvider )
{
- $routeProvider.when('/', { templateUrl: 'template/creations/saves.html' });
- $routeProvider.when('/list/:Category/:Tag/', { templateUrl: 'template/creations/saves.html' });
+ $routeProvider.when( '/', { templateUrl: 'template/creations/saves.html' } );
+ $routeProvider.when( '/list/:Category/:Tag/', { templateUrl: 'template/creations/saves.html' } );
} );
var CreationScope = null;
@@ -15,7 +15,7 @@ function CSaves( $scope, $timeout, $location )
CreationScope = $scope;
CreationLocation = $location;
- CreationScope.Categories =
+ CreationScope.Categories =
[
"trending",
"popular",
@@ -38,28 +38,27 @@ function CSaves( $scope, $timeout, $location )
"others"
];
- $scope.IfElse = function ( b, a, c )
+ $scope.IfElse = function( b, a, c )
{
if ( b ) return a;
return c;
}
- $scope.OpenWorkshopFile = function (id)
+ $scope.OpenWorkshopFile = function( id )
{
if ( !id ) return;
- lua.Run("steamworks.ViewFile( %s )", String(id));
+ gmod.OpenWorkshopFile( id );
}
- $scope.SaveSave = function ()
+ $scope.SaveSave = function()
{
- lua.Run( "RunConsoleCommand( \"gm_save\", \"spawnmenu\" );" );
+ gmod.SaveSave();
$scope.SaveDisabled = "disabled";
- $timeout( function ()
+ $timeout( function()
{
$scope.SaveDisabled = "";
-
}, 5000 );
}
@@ -73,4 +72,4 @@ function SetMap( mapname )
{
CreationScope.MapName = mapname;
UpdateDigest( CreationScope, 10 );
-}
+}
Oops, something went wrong.

0 comments on commit 09d6938

Please sign in to comment.