mirror of
https://github.com/evilsocket/arc.git
synced 2024-05-26 22:37:37 +03:00
new: added defaults from/to local storage
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<title>Arc</title>
|
||||
|
||||
@@ -9,8 +10,8 @@
|
||||
<meta name="description" content="Arc Secrets Manager">
|
||||
<meta name="author" content="Simone 'evilsocket' Margaritelli">
|
||||
|
||||
<link rel="shortcut icon" type="image/png" href="/img/logo.png?v=2.3"/>
|
||||
<link rel="apple-touch-icon" href="/img/logo.png?v=2.3"/>
|
||||
<link rel="shortcut icon" type="image/png" href="/img/logo.png?v=2.3" />
|
||||
<link rel="apple-touch-icon" href="/img/logo.png?v=2.3" />
|
||||
|
||||
<link rel="stylesheet" href="/css/bootstrap/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/css/bootstrap/bootstrap-datetimepicker.min.css">
|
||||
@@ -56,6 +57,7 @@
|
||||
<script type="text/javascript" src="/js/notify.js"></script>
|
||||
<script type="text/javascript" src="/js/app.js"></script>
|
||||
</head>
|
||||
|
||||
<body id="ngscope" ng-app="PM" ng-controller="PMController">
|
||||
<div class="main-container container-fluid">
|
||||
|
||||
@@ -74,7 +76,8 @@
|
||||
<!-- if user is logged instead -->
|
||||
<span ng-if="arc.IsLogged()" ng-switch on="arc.HasStore()">
|
||||
|
||||
<div class="notifications badge badge-pill badge-warning" ng-if="status.events.length" ng-include src="'/views/notifications.html'">
|
||||
<div class="notifications badge badge-pill badge-warning" ng-if="status.events.length" ng-include
|
||||
src="'/views/notifications.html'">
|
||||
</div>
|
||||
|
||||
<!-- no store selected, show available stores -->
|
||||
@@ -82,12 +85,17 @@
|
||||
<ul id="stores_list" class="list-group stores-list">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<div class="col-4">
|
||||
<center class="action-button" ng-click="doLogout()">
|
||||
<i class="fa fa-sign-out" aria-hidden="true"></i>
|
||||
</center>
|
||||
</div>
|
||||
<div class="col-6" style="border-left: 1px solid #eee">
|
||||
<div class="col-4">
|
||||
<center class="action-button" ng-click="onSettings()">
|
||||
<i class="fa fa-cog" aria-hidden="true"></i>
|
||||
</center>
|
||||
</div>
|
||||
<div class="col-4" style="border-left: 1px solid #eee">
|
||||
<center class="action-button" ng-click="onNewStore()">
|
||||
<i class="fa fa-file" aria-hidden="true"></i>
|
||||
</center>
|
||||
@@ -107,6 +115,8 @@
|
||||
<span ng-include src="'/views/store_list_item.html'"></span>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div ng-include src="'/views/modals/settings.html'"></div>
|
||||
</div>
|
||||
|
||||
<!-- store selected, load records from it -->
|
||||
@@ -121,19 +131,14 @@
|
||||
</div>
|
||||
<h5 class="editable" id="store_title">{{ arc.store.title }}</h5>
|
||||
<script type="text/javascript">
|
||||
$('#store_title').editable(function(v){
|
||||
$('#store_title').editable(function (v) {
|
||||
$('#ngscope').scope().onStoreTitleChanged(v);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
<div class="col-6 input-group">
|
||||
<input
|
||||
type="text"
|
||||
id="search_filter"
|
||||
class="search-filter form-control border"
|
||||
ng-model="search"
|
||||
ng-change="updateFilter()"
|
||||
placeholder="Search ..."/>
|
||||
<input type="text" id="search_filter" class="search-filter form-control border" ng-model="search"
|
||||
ng-change="updateFilter()" placeholder="Search ..." />
|
||||
</div>
|
||||
</div>
|
||||
<!-- will show session expire time when approaching 5 minutes left -->
|
||||
@@ -166,13 +171,9 @@
|
||||
</small>
|
||||
</li>
|
||||
|
||||
<li
|
||||
ng-repeat="r in arc.records | orderBy:['pinned','updated_at']:true"
|
||||
class="list-group-item"
|
||||
id="secret_list_item_{{ r.id }}"
|
||||
ng-if="filterSecret(r)"
|
||||
ng-click="onShowSecret(r.id)"
|
||||
ng-class="{'expired': isExpired(r), 'expiring': isExpiring(r), 'pinned': isPinned(r) }">
|
||||
<li ng-repeat="r in arc.records | orderBy:['pinned','updated_at']:true" class="list-group-item"
|
||||
id="secret_list_item_{{ r.id }}" ng-if="filterSecret(r)" ng-click="onShowSecret(r.id)"
|
||||
ng-class="{'expired': isExpired(r), 'expiring': isExpiring(r), 'pinned': isPinned(r) }">
|
||||
<span ng-include src="'/views/secret_list_item.html?v=17'"></span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -203,10 +204,11 @@
|
||||
</span>
|
||||
|
||||
<a href="https://github.com/evilsocket/arc">Arc</a> was made with <span style="color:red">♥</span> by
|
||||
<a href="https://www.evilsocket.net/" target="_blank" >Simone 'evilsocket' Margaritelli</a>
|
||||
<a href="https://www.evilsocket.net/" target="_blank">Simone 'evilsocket' Margaritelli</a>
|
||||
</small>
|
||||
</center>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
675
webui/js/app.js
675
webui/js/app.js
File diff suppressed because it is too large
Load Diff
@@ -9,51 +9,61 @@
|
||||
var g_EntryCounter = 0;
|
||||
|
||||
var REGISTERED_TYPES = [
|
||||
new URLEntry( "URL", "" ),
|
||||
new InputEntry( "Text Input", "" ),
|
||||
new CheckboxEntry( "Checkbox", "" ),
|
||||
new PasswordEntry( "Password", "" ),
|
||||
new TOTPEntry( "2FA", "" ),
|
||||
new TextEntry( "Text", "" ),
|
||||
new MarkdownEntry( "Markdown", "" ),
|
||||
new HTMLEntry( "HTML", "" ),
|
||||
new CodeEntry( "Source Code", "" ),
|
||||
new FileEntry( "File(s)", "" ),
|
||||
new BTCAddressEntry( "Bitcoin Address", "" ),
|
||||
new URLEntry("URL", ""),
|
||||
new InputEntry("Text Input", ""),
|
||||
new CheckboxEntry("Checkbox", ""),
|
||||
new PasswordEntry("Password", ""),
|
||||
new TOTPEntry("2FA", ""),
|
||||
new TextEntry("Text", ""),
|
||||
new MarkdownEntry("Markdown", ""),
|
||||
new HTMLEntry("HTML", ""),
|
||||
new CodeEntry("Source Code", ""),
|
||||
new FileEntry("File(s)", ""),
|
||||
new BTCAddressEntry("Bitcoin Address", ""),
|
||||
];
|
||||
|
||||
var REGISTERED_TEMPLATES = [
|
||||
{ name: "Web Login", fields:[
|
||||
new URLEntry( "URL", "https://" ),
|
||||
new InputEntry( "Login", "" ),
|
||||
new PasswordEntry( "Password", "" )
|
||||
]},
|
||||
{ name: "Email Account", fields:[
|
||||
new InputEntry( "Provider", "" ),
|
||||
new InputEntry( "SMTP Server", "" ),
|
||||
new PasswordEntry( "SMTP Password", "" ),
|
||||
new InputEntry( "IMAP Server", "" ),
|
||||
new PasswordEntry( "IMAP Password", "" )
|
||||
]},
|
||||
{ name: "SSH / FTP Account", fields:[
|
||||
new URLEntry( "Hostname", "" ),
|
||||
new InputEntry( "Username", "" ),
|
||||
new PasswordEntry( "Password", "" )
|
||||
]},
|
||||
{ name: "Credit Card", fields:[
|
||||
new InputEntry( "Bank Name", "" ),
|
||||
new InputEntry( "Owner Name", "" ),
|
||||
new InputEntry( "Card Number", "" ),
|
||||
new InputEntry( "Valid Until", "" ),
|
||||
new PasswordEntry( "CVV", "" )
|
||||
]},
|
||||
{ name: "Simple List", fields:[
|
||||
new CheckboxEntry( "Option A", "" ),
|
||||
new CheckboxEntry( "Option B", "" ),
|
||||
new CheckboxEntry( "Option C", "" ),
|
||||
new CheckboxEntry( "Option D", "" ),
|
||||
new CheckboxEntry( "Option E", "" ),
|
||||
]}
|
||||
{
|
||||
name: "Web Login", fields: [
|
||||
new URLEntry("URL", "https://"),
|
||||
new InputEntry("Login", "<default_login>"),
|
||||
new PasswordEntry("Password", "")
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Email Account", fields: [
|
||||
new InputEntry("Provider", ""),
|
||||
new InputEntry("SMTP Server", ""),
|
||||
new PasswordEntry("SMTP Password", ""),
|
||||
new InputEntry("IMAP Server", ""),
|
||||
new PasswordEntry("IMAP Password", "")
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "SSH / FTP Account", fields: [
|
||||
new URLEntry("Hostname", ""),
|
||||
new InputEntry("Username", "<default_username>"),
|
||||
new PasswordEntry("Password", "")
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Credit Card", fields: [
|
||||
new InputEntry("Bank Name", ""),
|
||||
new InputEntry("Owner Name", "<default_full_name>"),
|
||||
new InputEntry("Card Number", ""),
|
||||
new InputEntry("Valid Until", ""),
|
||||
new PasswordEntry("CVV", "")
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Simple List", fields: [
|
||||
new CheckboxEntry("Option A", ""),
|
||||
new CheckboxEntry("Option B", ""),
|
||||
new CheckboxEntry("Option C", ""),
|
||||
new CheckboxEntry("Option D", ""),
|
||||
new CheckboxEntry("Option E", ""),
|
||||
]
|
||||
}
|
||||
];
|
||||
|
||||
/*
|
||||
@@ -110,34 +120,47 @@ function escapeHtml(string) {
|
||||
|
||||
// Get a registered entry given its type.
|
||||
function TypeProto(type) {
|
||||
for( var i = 0; i < REGISTERED_TYPES.length; i++ ) {
|
||||
var registered = REGISTERED_TYPES[i];
|
||||
if( registered.type == type ) {
|
||||
return registered;
|
||||
}
|
||||
for (var i = 0; i < REGISTERED_TYPES.length; i++) {
|
||||
var registered = REGISTERED_TYPES[i];
|
||||
if (registered.type == type) {
|
||||
return registered;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
// Clone a registered entry and make the instance id unique.
|
||||
function TypeClone(e) {
|
||||
var clone = $.extend( true, {}, e );
|
||||
var clone = $.extend(true, {}, e);
|
||||
|
||||
clone.id += '_' + g_EntryCounter++;
|
||||
clone.id += '_' + g_EntryCounter++;
|
||||
|
||||
if (clone.value.indexOf('<default') == 0) {
|
||||
var def_value_name = 'arc_' + clone.value.replaceAll('<', '').replaceAll('>', '');
|
||||
// lookup default value from local storage
|
||||
if (window.localStorage.hasOwnProperty(def_value_name)) {
|
||||
clone.value = window.localStorage[def_value_name];
|
||||
} else {
|
||||
// no default value has been defined yet for this, fallback to empty clone
|
||||
clone.value = '';
|
||||
}
|
||||
} else {
|
||||
// create an empty clone
|
||||
clone.value = "";
|
||||
}
|
||||
|
||||
return clone;
|
||||
return clone;
|
||||
}
|
||||
|
||||
// Create an Entry derived object from the 'o' JSON object.
|
||||
function TypeFactory(o) {
|
||||
var proto = TypeProto(o.type);
|
||||
var entry = TypeClone(proto);
|
||||
var proto = TypeProto(o.type);
|
||||
var entry = TypeClone(proto);
|
||||
|
||||
entry.Populate(o);
|
||||
entry.Populate(o);
|
||||
|
||||
return entry;
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
|
||||
53
webui/views/modals/settings.html
Normal file
53
webui/views/modals/settings.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<div class="modal modal-full" id="settings_modal" role="dialog" aria-hidden="true" tabindex="-1">
|
||||
<div class="modal-dialog modal-dialog-full" role="document">
|
||||
<div class="modal-content modal-content-full">
|
||||
|
||||
<div class="modal-body modal-body-full" id="settings_body">
|
||||
<form id="settings_form">
|
||||
<div class="form-group">
|
||||
<h1>Defaults</h1>
|
||||
<div style="clear:both"></div>
|
||||
<small class="form-text text-muted" id="cleartext-warning">
|
||||
You can optionally define default values to be used in secret templates.
|
||||
</small>
|
||||
|
||||
<br />
|
||||
|
||||
<div class="form-group">
|
||||
<h5 class="editable label label-default entry-title label-0">Login</h5>
|
||||
<div style="clear:both"></div>
|
||||
<div class="input-group mif">
|
||||
<input class="form-control" data-entry-type="0" type="text" name="arc_default_login"
|
||||
id="arc_default_login" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<h5 class="editable label label-default entry-title label-0">Username</h5>
|
||||
<div style="clear:both"></div>
|
||||
<div class="input-group mif">
|
||||
<input class="form-control" data-entry-type="0" type="text" name="arc_default_username"
|
||||
id="arc_default_username" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<h5 class="editable label label-default entry-title label-0">Full Name</h5>
|
||||
<div style="clear:both"></div>
|
||||
<div class="input-group mif">
|
||||
<input class="form-control" data-entry-type="0" type="text" name="arc_default_full_name"
|
||||
id="arc_default_full_name" value="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br />
|
||||
|
||||
<button type="submit" class="btn btn-secondary float-right" ng-click="doSaveSettings()"
|
||||
id="saveSettingsButton">Save</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div> <!-- content -->
|
||||
</div> <!-- dialog -->
|
||||
</div>
|
||||
Reference in New Issue
Block a user