blob: 1627d0383ed9b4a19a83085eaeeb2227feedea92 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
<!DOCTYPE html>
<html>
<head>
<title>REDIRECTOR</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/redirector.css" />
<!-- ☈ -->
<link rel="shortcut icon" href="images/icon32active.png" />
<script src="js/firefox/page-shim.js"></script>
<script src="js/angular.min.js"></script>
<script src="js/redirect.js"></script>
<script src="js/app.js"></script>
<script src="js/controllers/redirectorpage.js"></script>
<script src="js/controllers/editredirect.js"></script>
<script src="js/controllers/deleteredirect.js"></script>
<script src="js/controllers/importexport.js"></script>
<script src="js/controllers/listredirects.js"></script>
</head>
<body ng-app="redirectorApp" ng-controller="RedirectorPageCtrl">
<div id="cover" ng-show="showEditForm || showDeleteForm"></div>
<!-- Confirmation form for deleting redirects -->
<div id="delete-redirect-form" ng-show="showDeleteForm" ng-controller="DeleteRedirectCtrl">
<h3>Are you sure you want to delete this redirect?</h3>
<div>
<label>Description:</label>
<span>{{redirect.description}}</span>
</div>
<div>
<label>Example URL:</label>
<span>{{redirect.exampleUrl}}</span>
</div>
<div>
<label>Include pattern:</label>
<span>{{redirect.includePattern}}
</div>
<div>
<label>Redirect to:</label>
<span>{{redirect.redirectUrl}}</span>
</div>
<div>
<label>Pattern type:</label>
<span>{{redirect.patternType == 'W' ? 'Wildcard' : 'Regular Expression'}}</span>
</div>
<div class="button-container">
<a class="btn red large" ng-click="deleteRedirect()">Yes, delete it</a>
<a class="btn grey large" ng-click="cancelDelete()">No, don't delete it</a>
</div>
</div>
<!-- Form for creating and editing redirects -->
<div id="edit-redirect-form" ng-show="showEditForm" ng-controller="EditRedirectCtrl">
<h3>{{editIndex >= 0 ? 'Edit' : 'Create'}} Redirect</h3>
<div class="form-grid">
<div>
<label>Description:</label>
<div class="input-cell"><input type="text" ng-model="redirect.description" placeholder="Enter a description for your redirect rule" /></div>
</div>
<div>
<label>Example URL:</label>
<div class="input-cell"><input type="text" ng-model="redirect.exampleUrl" ng-change="redirect.updateExampleResult()" placeholder="http://example.com/some/path?a=1" /></div>
</div>
<div>
<label>Include pattern:</label>
<div class="input-cell"><input type="text" ng-model="redirect.includePattern" ng-change="redirect.updateExampleResult()" placeholder="Pattern that matches the urls you want to redirect" /></div>
</div>
<div>
<label>Redirect to:</label>
<div class="input-cell"><input type="text" ng-model="redirect.redirectUrl" ng-change="redirect.updateExampleResult()" placeholder="The url you want to redirect requests to" /></div>
</div>
<div>
<label>Pattern type:</label>
<div class="input-cell">
<label id="wildcardtype">
<input type="radio" ng-change="redirect.updateExampleResult()" ng-model="redirect.patternType" name="patterntype" value="W">Wildcard</label>
<label id="regextype">
<input type="radio" ng-change="redirect.updateExampleResult()" ng-model="redirect.patternType" name="patterntype" value="R">Regular Expression</label>
</div>
</div>
<div>
<label>Example result:</label>
<div class="input-cell"><span class="error example-result-error" ng-show="redirect.error">{{redirect.error}}</span><span class="example-result" ng-show="redirect.exampleResult">{{redirect.exampleResult}}</span></div>
</div>
</div>
<div id="advanced-toggle">
<a ng-click="showAdvanced=true" ng-show="!showAdvanced">Show advanced options...</a>
<a ng-click="showAdvanced=false" ng-show="showAdvanced">Hide advanced options...</a>
</div>
<div class="form-grid advanced" ng-show="showAdvanced">
<div>
<label>Exclude pattern:</label>
<div class="input-cell"><input type="text" ng-change="redirect.updateExampleResult()" ng-model="redirect.excludePattern" placeholder="Pattern to exclude certain urls from the redirection"/></div>
</div>
<div>
<label for="unescape-matches">Unescape matches:</label>
<div class="input-cell"><input id="unescape-matches" ng-change="redirect.updateExampleResult()" ng-model="redirect.unescapeMatches" type="checkbox"><span class="placeholder">E.g. turn %2Fbar%2Ffoo%3Fx%3D2 into /bar/foo?x=2</span></div>
</div>
<div>
<label for="escape-matches">Escape matches:</label>
<div class="input-cell"><input id="escape-matches" ng-change="redirect.updateExampleResult()" ng-model="redirect.escapeMatches" type="checkbox"><span class="placeholder">E.g. turn /bar/foo?x=2 into %2Fbar%2Ffoo%3Fx%3D2</span></div>
</div>
<div>
<label>Apply to:</label>
<div class="input-cell" id="apply-to">
<label ng-repeat="(key,value) in requestTypes"><input type="checkbox" ng-checked="appliesTo(key)" ng-click="toggleApplies(key)"><span>{{value}}</span></label>
</div>
</div>
</div>
<div class="button-container">
<a ng-class="{disabled:redirect.error || redirect.includePattern == ''}" class="btn green large" ng-click="saveRedirect()">Save</a>
<a class="btn red large" ng-click="cancelEdit()">Cancel</a>
</div>
</div>
<div id="blur-wrapper" ng-class="{blur: showEditForm || showDeleteForm}">
<h1>REDIRECTOR</h1>
<h5>Go where <em>YOU</em> want!</h5>
<div id="menu">
<a class="btn blue large" ng-click="createNewRedirect()">Create new redirect</a>
<!-- Importing/Exporting of redirects -->
<span ng-controller="ImportExportCtrl">
<input type="file" id="import-file" fileselected="importRedirects($file)" accept=".rjson,.json,.txt,text/*" />
<label for="import-file" class="btn blue large">Import</label>
<a class="btn blue large" ng-mousedown="updateExportLink()" ng-href="{{redirectDownload}}" download="Redirector.json">Export</a>
</span>
<a class="btn blue large" href="help.html" target="_blank">Help</a>
</div>
<div id="message-box" ng-class="{visible : message, error : messageType == 'error', success : messageType == 'success'}">
{{message}}
<a ng-click="message=null">✖</a>
</div>
<!-- List of existing redirects -->
<div class="redirect-table" ng-controller="ListRedirectsCtrl">
<div class="redirect-row" ng-class="{disabled: r.disabled}" ng-repeat="r in redirects">
<h4><span class="disabled-marker" ng-show="r.disabled">[Disabled] </span><span>{{r.description}}</span></h4>
<div class="redirect-info">
<div>
<label>Redirect:</label>
<p>{{r.includePattern}}</p>
</div>
<div>
<label>to:</label><p>{{r.redirectUrl}}</p>
</div>
<div ng-show="r.excludePattern">
<label>excluding:</label><p>asdfasdf</p>
</div>
<div>
<label>Example:</label> <p><span class="error" ng-show="r.error">{{r.error}}</span><span ng-show="r.exampleResult">{{r.exampleUrl}} <span class="arrow">→</span> {{r.exampleResult}}</span></p>
</div>
<div>
<label>Applies to:</label> <p>{{r.appliesTo|requestTypeDisplay}}</p>
</div>
</div>
<div>
<a class="btn medium blue" ng-click="toggleDisabled(r)">{{r.disabled ? "Enable" : "Disable"}}</a>
<a class="btn medium green" ng-click="editRedirect($index)">Edit</a>
<a class="btn medium red" ng-click="confirmDeleteRedirect($index)">Delete</a>
<a class="btn medium grey move-up-btn" ng-class="{disabled:$first}" ng-click="moveUp($index)">▲</a>
<a class="btn medium grey move-down-btn" ng-class="{disabled:$last}" ng-click="moveDown($index)">▼</a>
</div>
</div>
</div>
<footer>
<small>Redirector is created by <a target="_blank" href="http://einaregilsson.com">Einar Egilsson</a></small>
</footer>
</div>
</body>
</html>
|