forked from Zhang-Sir/advancedtomato-gui-chinese
-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-upgrade.asp
156 lines (136 loc) · 4.59 KB
/
admin-upgrade.asp
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
<!--
Tomato GUI
Copyright (C) 2006-2010 Jonathan Zarate
http://www.polarcloud.com/tomato/
For use with Tomato Firmware only.
No part of this file may be used without permission.
--><title>Firmware Upgrade</title>
<content>
<style>
#afu-progress {
display: block;
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
z-index: 20;
background: #fff;
color: #5A5A5A;
opacity: 0;
transition: opacity 250ms ease-out;
}
#afu-progress .text-container {
position: absolute;
display: block;
text-align: center;
font-size: 14px;
width: 100%;
height: 150px;
top: 30%;
margin-top: -75px;
transform: scale(0.2);
transition: all 350ms ease-out;
}
#afu-progress.active {
opacity: 1;
}
#afu-progress.active .text-container {
transform: scale(1);
top: 40%;
}
.line-table tr { background: transparent !important; }
.line-table tr:last-child { border: 0; }
</style>
<script type="text/javascript">
// <% nvram("jffs2_on"); %>
function clock()
{
var t = ((new Date()).getTime() - startTime) / 1000;
elem.setInnerHTML('afu-time', Math.floor(t / 60) + ':' + Number(Math.floor(t % 60)).pad(2));
}
function upgrade() {
var name;
var i;
var fom = document.form_upgrade;
var ext;
name = fixFile(fom.file.value);
if (name.search(/\.(bin|trx|chk)$/i) == -1) {
alert('Expecting a ".bin", ".trx" or ".chk" file.');
return false;
}
if (!confirm('Are you sure you want to flash ' + name + '?')) return;
E('afu-upgrade-button').disabled = true;
// Some cool things
$('#wrapper > .content').css('position', 'static');
$('#afu-progress').clone().prependTo('#wrapper').show().addClass('active');
startTime = (new Date()).getTime();
setInterval('clock()', 500);
fom.action += '?_reset=' + (E('f_reset').checked ? "1" : "0");
form.addIdAction(fom);
fom.submit();
}
</script>
<div id="afu-input">
<div class="alert alert-warning icon">
<h5>Attention!</h5>Sometimes an image file can become corrupted while downloading to your computer.
To avoid problems, please verify the MD5 checksum (<a target="_blank" href="http://en.wikipedia.org/wiki/Checksum">Read more</a>) of the AdvancedTomato image file before attempting to flash your router.
<a class="close"><i class="icon-cancel"></i></a>
</div>
<form name="form_upgrade" method="post" action="upgrade.cgi" encType="multipart/form-data">
<div class="box">
<div class="heading">Router Upgrade</div>
<div class="content">
<fieldset>
<label class="control-left-label col-sm-3">Select new image:</label>
<div class="col-sm-9"><input class="uploadfile" type="file" name="file" size="50">
<button type="button" value="Upgrade" id="afu-upgrade-button" onclick="upgrade();" class="btn btn-danger">Upgrade <i class="icon-upload"></i></button>
</div>
</fieldset>
<fieldset>
<label class="control-left-label col-sm-3" for="f_reset">Restore defaults</label>
<div class="col-sm-9">
<div id="reset-input">
<div class="checkbox c-checkbox"><label><input class="custom" type="checkbox" id="f_reset">
<span class="icon-check"></span> After flashing, erase all data in NVRAM memory</label>
</div>
</div>
</div>
</fieldset>
</div>
</div>
<div class="box">
<div class="heading">Router Info</div>
<div class="content">
<table class="line-table" id="version-table">
<tr><td>Current Version:</td><td> <% version(1); %></td></tr>
</table>
</div>
</div>
<div id="afu-progress" style="display:none;">
<div class="text-container">
<div class="spinner spinner-large"></div><br /><br />
<b id="afu-time">0:00</b><br />
Please wait while new image is being uploaded and flashed...<br />
<b>Do not interrupt web browser or the router!</b>
</div>
</div>
</form>
</div>
/* JFFS2-BEGIN */
<div class="alert alert-error" style="display:none;" id="jwarn">
<h5>Upgrade forbidden!</h5>
An upgrade may overwrite the JFFS partition currently in use. Before upgrading,
please backup the contents of the JFFS partition, disable it, then reboot the router.
<a href="/#admin-jffs2.asp">Disable »</a>
</div>
<script type="text/javascript">
// <% sysinfo(); %>
$('#version-table').append('<tr><td>Free Memory:</td><td> ' + scaleSize(sysinfo.totalfreeram) + ' <small>(aprox. size that can be buffered completely in RAM)</small></td></tr>');
if (nvram.jffs2_on != '0') {
E('jwarn').style.display = '';
E('afu-input').style.display = 'none';
}
</script>
/* JFFS2-END */
</content>