update themes module (#38)

This commit is contained in:
trashbo4t
2018-08-23 17:06:59 -04:00
committed by Sebastian Kinne
parent 2c593370fe
commit 3c77b1b3a6
4 changed files with 46 additions and 22 deletions

View File

@@ -1,5 +1,9 @@
<?php namespace pineapple;
/*
* Author: trashbo4t (github.com/trashbo4t)
*/
class Themes extends Module
{
// CONSTANTS
@@ -26,7 +30,6 @@ class Themes extends Module
private $ALL_MODULES = array(
"Dashboard",
"Recon",
"Profiling",
"Clients",
"ModuleManager",
"Filters",
@@ -37,6 +40,7 @@ class Themes extends Module
"Networking",
"Configuration",
"Advanced",
"Notes",
"Help",
);
/*
@@ -200,6 +204,9 @@ class Themes extends Module
* $moduleName -> String name of module, can be any format (nEtWoRkIng) because it gets formatted
* $color -> string name of the color, used for index of mapping
* $brightness -> string name of brightness, used for map selection
*
* This is a neat little technique to change image colors, since the images are SVG we search and
* replace the original RBG colors in the image file with the new RBG hex values.
*/
public function replaceModuleImage($moduleName, $color, $brightness)
{
@@ -562,4 +569,4 @@ class Themes extends Module
}
return false;
}
}
}

View File

@@ -1,5 +1,8 @@
registerController("ThemesController", ['$api', '$scope','$window','$route', '$http', function ($api, $scope, $window, $route, $http) {
/*
* Author: trashbo4t (github.com/trashbo4t)
*/
getThemes();
getCurrentTheme();
backupFiles();
@@ -36,8 +39,8 @@ registerController("ThemesController", ['$api', '$scope','$window','$route', '$h
$scope.dashboardcontrastBrightness = 'normal';
$scope.reconcontrastText = 'light';
$scope.reconcontrastBrightness = 'normal';
$scope.profilingcontrastText = 'light';
$scope.profilingcontrastBrightness = 'normal';
$scope.notescontrastText = 'light';
$scope.notescontrastBrightness = 'normal';
$scope.clientscontrastText = 'light';
$scope.clientscontrastBrightness = 'normal';
$scope.modulescontrastText = 'light';
@@ -196,15 +199,15 @@ registerController("ThemesController", ['$api', '$scope','$window','$route', '$h
}
});
};
$scope.changeProfiling = function(){
$scope.changeNotes = function(){
$api.request({
module: "Themes",
action: "replaceImage",
img: 'Profiling',
color: $scope.profilingcontrastText,
brightness: $scope.profilingcontrastBrightness
img: 'Notes',
color: $scope.notescontrastText,
brightness: $scope.notescontrastBrightness
}, function(response) {
$scope.sendMessage("Profiling Icon", "set to " + $scope.profilingcontrastText + " (" + $scope.profilingcontrastBrightness + ")");
$scope.sendMessage("Notes Icon", "set to " + $scope.notescontrastText + " (" + $scope.notescontrastBrightness + ")");
log("changeDashboard", "Success? " + response.success + " " + response.message);
if ($scope.autoRefresh) {
$window.location.reload();
@@ -405,8 +408,8 @@ registerController("ThemesController", ['$api', '$scope','$window','$route', '$h
$scope.dashboardcontrastBrightness = response.dashboardbrightness;
$scope.reconcontrastText = response.recon;
$scope.reconcontrastBrightness = response.reconbrightness;
$scope.profilingcontrastText = response.profiling;
$scope.profilingcontrastBrightness = response.profilingbrightness;
$scope.notescontrastText = response.notes;
$scope.notescontrastBrightness = response.notesbrightness;
$scope.clientscontrastText = response.clients;
$scope.clientscontrastBrightness = response.clientsbrightness;
$scope.modulescontrastText = response.modulemanager;
@@ -601,4 +604,4 @@ registerController("ThemesController", ['$api', '$scope','$window','$route', '$h
}
});
}
}]);
}]);

View File

@@ -1,3 +1,7 @@
<!-- Author: -->
<!-- trashbo4t -->
<!-- (github.com/trashbo4t) -->
<div class="row" ng-controller="ThemesController">
<div class="col-md-3">
@@ -78,7 +82,6 @@
<tr><td>Favicon</td><td> {{ faviconcontrastText }}</td><td> N/A </td> </tr>
<tr><td>Dashboard</td><td> {{ dashboardcontrastText }}</td><td> {{ dashboardcontrastBrightness }}</td> </tr>
<tr><td>Recon</td><td> {{ reconcontrastText }}</td><td> {{ reconcontrastBrightness }}</td> </tr>
<tr><td>Profiling</td><td> {{ profilingcontrastText }}</td><td> {{ profilingcontrastBrightness }}</td> </tr>
<tr><td>Clients</td><td> {{ clientscontrastText }}</td><td> {{ clientscontrastBrightness }}</td> </tr>
<tr><td>Modules</td><td> {{ modulescontrastText }}</td><td> {{ modulescontrastBrightness }}</td> </tr>
<tr><td>Filters</td><td> {{ filterscontrastText }}</td><td> {{ filterscontrastBrightness }}</td> </tr>
@@ -89,6 +92,7 @@
<tr><td>Networking</td><td> {{ networkingcontrastText }}</td><td> {{ networkingcontrastBrightness }}</td> </tr>
<tr><td>Configuration</td><td> {{ configurationcontrastText }}</td><td> {{ configurationcontrastBrightness }}</td> </tr>
<tr><td>Advanced</td><td> {{ advancedcontrastText }}</td><td> {{ advancedcontrastBrightness }}</td> </tr>
<tr><td>Notes</td><td> {{ notescontrastText }}</td><td> {{ notescontrastBrightness }}</td> </tr>
<tr><td>Help</td><td> {{ helpcontrastText }}</td><td> {{ helpcontrastBrightness }}</td> </tr>
</tbody>
</table>
@@ -376,26 +380,27 @@
</button>
</td>
</tr>
<td><b>Profiling</b></td>
<td><img src="/modules/Profiling/module_icon.svg" width="30" height="30" /></td>
<td><select ng-model="profilingcontrastText"
<td><b>Notes</b></td>
<td><img src="/modules/Notes/module_icon.svg" width="30" height="30" /></td>
<td><select ng-model="notescontrastText"
ng-style="selectOptions"
ng-options="x for x in colors"
ng-value="{{ profilingcontrastText }}"
ng-value="{{ notescontrastText }}"
>
</select>
</td>
<td><select ng-model="profilingcontrastBrightness"
<td><select ng-model="notescontrastBrightness"
ng-style="selectOptions"
ng-options="x for x in brightness"
ng-value="{{ profilingcontrastBrightness }}"
ng-value="{{ notescontrastBrightness }}"
>
</select>
</td>
<td><button class="btn btn-default"
type="button"
ng-click="changeProfiling()">
ng-click="changeNotes()">
Apply
</button>
</td>
@@ -755,6 +760,13 @@
</div>
<div id="collapseChangelog" class="panel-collapse collapse">
<div class="panel-body">
<ul>
<li><b>1.1</b></li>
<ul>
<li class="text-muted">Removed profiling icon options</li>
<li class="text-muted">Added "Notes" icon options</li>
</ul>
</ul>
<ul>
<li><b>1.0</b></li>
<ul>
@@ -783,4 +795,4 @@
</div>
</div>
</div>

View File

@@ -6,5 +6,7 @@
"tetra"
],
"title": "Themes",
"version": "1.0"
"description": "Create, download, and share custom themes",
"version": "1.1",
"author": "trashbo4t"
}