settings.html 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653
  1. <!DOCTYPE html>
  2. <html>
  3. <!-- HEAD -->
  4. <head>
  5. <meta charset="UTF-8">
  6. <title>MOD Settings</title>
  7. <link rel="apple-touch-icon" sizes="57x57" href="img/favicon/apple-icon-57x57.png">
  8. <link rel="apple-touch-icon" sizes="60x60" href="img/favicon/apple-icon-60x60.png">
  9. <link rel="apple-touch-icon" sizes="72x72" href="img/favicon/apple-icon-72x72.png">
  10. <link rel="apple-touch-icon" sizes="76x76" href="img/favicon/apple-icon-76x76.png">
  11. <link rel="apple-touch-icon" sizes="114x114" href="img/favicon/apple-icon-114x114.png">
  12. <link rel="apple-touch-icon" sizes="120x120" href="img/favicon/apple-icon-120x120.png">
  13. <link rel="apple-touch-icon" sizes="144x144" href="img/favicon/apple-icon-144x144.png">
  14. <link rel="apple-touch-icon" sizes="152x152" href="img/favicon/apple-icon-152x152.png">
  15. <link rel="apple-touch-icon" sizes="180x180" href="img/favicon/apple-icon-180x180.png">
  16. <link rel="icon" type="image/png" sizes="192x192" href="img/favicon/android-icon-192x192.png">
  17. <link rel="icon" type="image/png" sizes="32x32" href="img/favicon/favicon-32x32.png">
  18. <link rel="icon" type="image/png" sizes="96x96" href="img/favicon/favicon-96x96.png">
  19. <link rel="icon" type="image/png" sizes="16x16" href="img/favicon/favicon-16x16.png">
  20. <link rel="manifest" href="img/favicon/manifest.json">
  21. <meta name="msapplication-TileColor" content="#111111">
  22. <meta name="msapplication-TileImage" content="img/favicon/ms-icon-144x144.png">
  23. <meta name="theme-color" content="#111111">
  24. <link rel="stylesheet" type="text/css" href="css/fontello/css/fontello.css?v={{version}}"/>
  25. <link rel="stylesheet" type="text/css" href="css/main.css?v={{version}}"/>
  26. <link rel="stylesheet" type="text/css" href="css/dashboard.css?v={{version}}"/>
  27. <link rel="stylesheet" type="text/css" href="css/fonts.css?v={{version}}"/>
  28. <style type="text/css" media="screen">
  29. .settings-page-content {
  30. background: #111;
  31. left: 245px;
  32. height: calc(100% - 50px);
  33. margin: 0;
  34. padding: 0;
  35. position: fixed;
  36. text-align: left;
  37. top: 45px;
  38. width: calc(100% - 290px);
  39. overflow-y: auto;
  40. }
  41. .settings-page {
  42. max-width: 900px;
  43. padding-bottom: 2em;
  44. }
  45. .settings-page-content h1 {
  46. font-size: 2.2em;
  47. padding: 0em;
  48. max-height: 2em;
  49. display: block;
  50. margin: 0.5em 0.8em 0 0.8em;
  51. padding-bottom: 0.2em;
  52. color: white;
  53. white-space: nowrap;
  54. overflow: hidden;
  55. }
  56. .settings-page-content h2 {
  57. color: #BBB;
  58. font-size: 1.5em;
  59. margin: 1em 0 0.4em 0;
  60. }
  61. .settings-page-content form {
  62. margin: 0 2em;
  63. color: #666;
  64. }
  65. .settings-page-content form label,
  66. .settings-page-content form p {
  67. color: #999;
  68. font-size: 1.1em;
  69. }
  70. .settings-page-content form label input {
  71. color: #555;
  72. }
  73. #settings-reboot-needed {
  74. background: #f29446;
  75. color: white;
  76. font-size: 1.1em;
  77. padding: 0.8em 2em;
  78. position: sticky;
  79. top: 0;
  80. z-index: 1;
  81. }
  82. #settings-reboot-needed input {
  83. color: #555;
  84. float: left;
  85. margin: 0.4em 2em 0 0;
  86. }
  87. #bank-library {
  88. bottom: 0px;
  89. }
  90. #bank-library #bank-list {
  91. bottom: 5px;
  92. left: 5px;
  93. width: 200px;
  94. }
  95. #bank-library #bank-list div.add-bank {
  96. padding-left: 5px;
  97. padding-right: 5px;
  98. text-align: center;
  99. }
  100. </style>
  101. <script type="text/javascript" src="js/lib/jquery-1.9.1.min.js?v={{version}}"></script>
  102. <script type="text/javascript" src="js/lib/jquery-ui-1.10.1.custom.min.js?v={{version}}"></script>
  103. <script type="text/javascript" src="js/lib/jquery.ui.touch-punch.min.js?v={{version}}"></script>
  104. <script type="text/javascript" src="js/lib/jquery.ba-resize.min.js?v={{version}}"></script>
  105. <script type="text/javascript" src="js/lib/mustache.js?v={{version}}"></script>
  106. <script type="text/javascript" src="js/lib/jquery.svg.js?v={{version}}"></script>
  107. <script type="text/javascript" src="js/lib/sprintf-0.6.js?v={{version}}"></script>
  108. <script type="text/javascript" src="js/lib/jquery.mousewheel.min.js?v={{version}}"></script>
  109. <script type="text/javascript">
  110. {% autoescape None %}
  111. SITEURL = '{{cloud_url}}'
  112. CONTROLCHAIN_URL = '{{controlchain_url}}'
  113. VERSION = '{{version}}'
  114. var TEMPLATES = {}
  115. var NOTIFICATIONS_ENABLED = true
  116. var HMI_EEPROM = {{hmi_eeprom}}
  117. var PREFERENCES = {{preferences}}
  118. var PLATFORM = '{{platform}}'
  119. var INFO = {
  120. "hwname": "",
  121. "sysdate": "",
  122. "python": {},
  123. "uname": {}
  124. }
  125. // Settings that are only read when the unit boots, by their name in /system/prefs
  126. var REBOOT_PREFS = {
  127. "jack_mono_copy" : "#prefs-audio-mono-copy",
  128. "separate_spdif_outs": "#prefs-audio-separate-spdif-outs",
  129. "autorestart_hmi" : "#prefs-workarounds-autorestart-hmi",
  130. }
  131. var REBOOT_STORAGE_KEY = "mod-settings-reboot-needed"
  132. var SYSPREFS = null
  133. var bootPrefs = null
  134. var savedNotification = null
  135. function bool2str(ok) {
  136. return ok ? "true" : "false"
  137. }
  138. function report_saved(ok) {
  139. if (savedNotification) {
  140. clearTimeout(savedNotification.closeTimeout)
  141. savedNotification.close()
  142. }
  143. if (ok) {
  144. savedNotification = new Notification("info", "Saved", 2000)
  145. } else {
  146. savedNotification = new Notification("error", "Could not save this setting")
  147. // show what is really set on the unit
  148. refresh_sysprefs()
  149. }
  150. }
  151. // The values the unit booted with are the ones found when this page loads, unless a change was made
  152. // earlier and the unit has not been rebooted since. The browser remembers that case.
  153. function load_boot_prefs() {
  154. if (bootPrefs != null || SYSPREFS == null || INFO.uptime === undefined) {
  155. return
  156. }
  157. var stored = null
  158. try {
  159. stored = JSON.parse(localStorage.getItem(REBOOT_STORAGE_KEY))
  160. } catch (e) {}
  161. if (stored && stored.prefs && INFO.uptime != null && stored.time > Date.now() - INFO.uptime * 1000) {
  162. bootPrefs = stored.prefs
  163. } else {
  164. bootPrefs = {}
  165. for (var label in REBOOT_PREFS) {
  166. bootPrefs[label] = SYSPREFS[label]
  167. }
  168. }
  169. }
  170. function refresh_reboot_needed() {
  171. load_boot_prefs()
  172. if (bootPrefs == null) {
  173. return
  174. }
  175. var needed = false
  176. for (var label in REBOOT_PREFS) {
  177. if (label in bootPrefs && $(REBOOT_PREFS[label]).prop("checked") != bootPrefs[label]) {
  178. needed = true
  179. }
  180. }
  181. try {
  182. if (needed) {
  183. localStorage.setItem(REBOOT_STORAGE_KEY, JSON.stringify({ time: Date.now(), prefs: bootPrefs }))
  184. } else {
  185. localStorage.removeItem(REBOOT_STORAGE_KEY)
  186. }
  187. } catch (e) {}
  188. if (needed) {
  189. $("#settings-reboot-needed").show()
  190. } else {
  191. $("#settings-reboot-needed").hide()
  192. }
  193. }
  194. function refresh_sysinfo() {
  195. $.ajax({
  196. url: '/system/info',
  197. method: 'GET',
  198. success: function (info) {
  199. INFO = info
  200. $("#info-system-unit").text(INFO.hwname)
  201. $("#info-system-date").text(INFO.sysdate)
  202. $("#info-kernel-machine").text(INFO.uname.machine)
  203. $("#info-kernel-release").text(INFO.uname.release)
  204. $("#info-kernel-version").text(INFO.uname.version)
  205. if (info.platform != "duox" || info.model == "duox:aarch64-a53") {
  206. $("#prefs-audio-separate-spdif-outs_div").hide()
  207. }
  208. if (INFO.uptime === undefined) {
  209. INFO.uptime = null
  210. }
  211. refresh_reboot_needed()
  212. },
  213. error: function () {
  214. INFO.uptime = null
  215. refresh_reboot_needed()
  216. },
  217. cache: false,
  218. global: false,
  219. dataType: 'json'
  220. })
  221. }
  222. // the buffer size radio always shows the size JACK is running at (the server keeps the saved one equal to it)
  223. function set_buffer_size_radio(size) {
  224. $("input[name=prefs-audio-buffer-size][value='" + size + "']").prop("checked", true)
  225. }
  226. function refresh_sysprefs() {
  227. $.ajax({
  228. url: '/system/prefs',
  229. method: 'GET',
  230. success: function (resp) {
  231. if (resp.bluetooth_name != null)
  232. {
  233. $("#prefs-bluetooth-custom").prop("checked", true)
  234. $("#prefs-bluetooth-name").prop("disabled", false).val(resp.bluetooth_name)
  235. }
  236. else
  237. {
  238. $("#prefs-bluetooth-custom").prop("checked", false)
  239. $("#prefs-bluetooth-name").prop("disabled", true)
  240. }
  241. $("#prefs-audio-mono-copy").prop("checked", resp.jack_mono_copy)
  242. $("#prefs-audio-separate-spdif-outs").prop("checked", resp.separate_spdif_outs)
  243. $("#prefs-service-netmanager").prop("checked", resp.service_netmanager)
  244. $("#prefs-workarounds-autorestart-hmi").prop("checked", resp.autorestart_hmi)
  245. SYSPREFS = resp
  246. refresh_reboot_needed()
  247. },
  248. cache: false,
  249. global: false,
  250. dataType: 'json'
  251. })
  252. }
  253. function report_device_updates_failed() {
  254. $("#settings-cc-firmware-status").html(
  255. "<b>The Control Chain firmware server did not answer.</b><br/>"
  256. + "The list of devices comes from the internet, through the computer or phone showing this page. "
  257. + "Check its connection and reload this page to try again.")
  258. }
  259. function refresh_device_updates(respDev, respVer) {
  260. if (!respDev || !respVer) {
  261. return
  262. }
  263. if (respDev.api_version != 1 || respVer.api_version != 1) {
  264. $("#settings-cc-firmware-status").html(
  265. "<b>The Control Chain firmware server gave an answer this MOD version does not understand.</b><br/>"
  266. + "Update the MOD and try again.")
  267. return
  268. }
  269. var elem = $('#settings-cc-firmware')
  270. $("#settings-cc-firmware-status").hide()
  271. for (var i in respDev.devices) {
  272. var dev = respDev.devices[i],
  273. text = "",
  274. note = ""
  275. if (dev.label) {
  276. var dev2 = respVer.devices[dev.uri]
  277. if (dev2) {
  278. dev.version = dev2.latest
  279. } else {
  280. dev.label = ""
  281. }
  282. }
  283. if (! dev.label) {
  284. note = "<br/>Note: Updates for this device need to be done manually."
  285. }
  286. text += "<h2>" + dev.name + "</h2>"
  287. text += "<p>" + dev.description.replace(/\n/g,"<br/>") + note + "</p>"
  288. if (dev.label) {
  289. var labelcl = 'button-action-update-firmware'
  290. var labelid = 'button-action-update-firmware-'+i
  291. text += "<label>"
  292. text += "<input type='button' class='" + labelcl + "' id='" + labelid + "' value='Update firmware'></input>"
  293. text += " &nbsp; Latest version: v" + dev.version
  294. text += "</label>"
  295. }
  296. elem.append(text)
  297. }
  298. $(".button-action-update-firmware").click(function () {
  299. var self = $(this)
  300. if (self.hasClass("disabled")) {
  301. return
  302. }
  303. var dev_id = parseInt(this.id.replace("button-action-update-firmware-","")),
  304. dev = respDev.devices[dev_id]
  305. if (!dev || !dev.label) {
  306. new Bug("Couldn't download firmware, wrong Id")
  307. return
  308. }
  309. self.addClass("disabled")
  310. var url = CONTROLCHAIN_URL + "/file/" + dev.label + dev.version + ".bin"
  311. var transfer = new SimpleTransference(url, '/controlchain/download/')
  312. transfer.reportFinished = function () {
  313. self.removeClass("disabled")
  314. $('#cc-device-update-window').show()
  315. }
  316. transfer.reportError = function (error) {
  317. self.removeClass("disabled")
  318. new Bug("Couldn't download firmware, reason:<br/>" + error)
  319. }
  320. transfer.start()
  321. })
  322. }
  323. function show_blocker (action) {
  324. var block = $('<div class="screen-disconnected blocker">');
  325. var text;
  326. if (action == "delete") {
  327. text = 'Deleting data, please wait...';
  328. } else if (action == "reflash") {
  329. text = 'Flashing controller, please wait...';
  330. } else if (action == "export") {
  331. text = 'Exporting data, please wait...';
  332. } else if (action == "import") {
  333. text = 'Restoring data, please wait...<br/>This might take a few minutes.';
  334. } else if (action == "info") {
  335. text = 'Reading the USB stick, please wait...';
  336. } else {
  337. text = 'Please wait..'
  338. }
  339. block.html('<p>' + text + '</p>')
  340. block.css('overflow', 'hidden')
  341. $('body').append(block)
  342. return block
  343. }
  344. function config_set(key, value) {
  345. $.ajax({
  346. url: '/config/set',
  347. method: 'POST',
  348. data: {
  349. key: key,
  350. value: value,
  351. },
  352. success: function (resp) {
  353. console.log("success", resp)
  354. report_saved(resp === true)
  355. },
  356. error: function (resp) {
  357. console.log("error", resp)
  358. report_saved(false)
  359. },
  360. cache: false,
  361. dataType: 'json'
  362. })
  363. }
  364. function system_cleanup(favorites, hmiSettings, licenseKeys, banks, pedalboards, plugins, callback) {
  365. $.ajax({
  366. url: '/system/cleanup',
  367. method: 'POST',
  368. data: {
  369. favorites: favorites ? 1 : 0,
  370. hmiSettings: hmiSettings ? 1 : 0,
  371. licenseKeys: licenseKeys ? 1 : 0,
  372. banks: banks ? 1 : 0,
  373. pedalboards: pedalboards ? 1 : 0,
  374. plugins: plugins ? 1 : 0,
  375. },
  376. success: function (resp) {
  377. if (callback) {
  378. callback(resp)
  379. }
  380. },
  381. error: function (resp) {
  382. console.log("error", resp)
  383. alert("An error occurred: " + resp)
  384. },
  385. cache: false,
  386. dataType: 'json'
  387. })
  388. }
  389. function system_exechange(data, callback, errback) {
  390. $.ajax({
  391. url: '/system/exechange',
  392. method: 'POST',
  393. data: data,
  394. success: function (resp) {
  395. console.log("success", resp)
  396. if (callback) {
  397. callback(resp)
  398. }
  399. },
  400. error: function (resp) {
  401. console.log("error", resp)
  402. if (errback) {
  403. errback(resp)
  404. }
  405. },
  406. cache: false,
  407. dataType: 'json'
  408. })
  409. }
  410. // system_exechange for a setting: tells the user if it was saved
  411. function system_exechange_setting(data) {
  412. system_exechange(data, function (resp) {
  413. report_saved(resp === true)
  414. refresh_reboot_needed()
  415. }, function () {
  416. report_saved(false)
  417. })
  418. }
  419. function enable_service(name, enable, inverted, persistent) {
  420. var data = {
  421. 'type' : 'service',
  422. 'name' : name,
  423. 'enable' : enable ? 1 : 0,
  424. 'inverted' : inverted ? 1 : 0,
  425. 'persistent': persistent ? 1 : 0,
  426. }
  427. if (persistent) {
  428. system_exechange_setting(data)
  429. } else {
  430. system_exechange(data)
  431. }
  432. }
  433. function run_custom_command(cmd, callback, errback) {
  434. system_exechange({
  435. 'type': 'command',
  436. 'cmd' : cmd,
  437. }, callback, errback)
  438. }
  439. function write_file_contents(path, content) {
  440. system_exechange_setting({
  441. 'type' : 'filewrite',
  442. 'path' : path,
  443. 'content': content,
  444. })
  445. }
  446. function create_or_delete_file(path, create) {
  447. system_exechange_setting({
  448. 'type' : 'filecreate',
  449. 'path' : path,
  450. 'create': create ? 1 : 0,
  451. })
  452. }
  453. $('document').ready(function() {
  454. var self = this
  455. var cached_cpuLoad
  456. var ws = new WebSocket("ws://" + window.location.host + "/websocket")
  457. ws.onclose = function (evt) {
  458. if ($('body').find('.screen-disconnected').length != 0) {
  459. return
  460. }
  461. var block = $('<div class="screen-disconnected blocker">')
  462. block.html('<p>Disconnected</p>')
  463. var re = $("<div class='button icon'>Reload</div>").appendTo(block);
  464. re.css("background-image", "url(img/icons/25/reload.png)");
  465. re.click(function () { location.reload(); });
  466. $('body').append(block).css('overflow', 'hidden')
  467. $('#wrapper').css('z-index', -1)
  468. $('#bank-library').css('z-index', -1)
  469. }
  470. ws.onmessage = function (evt) {
  471. var data = evt.data
  472. var cmd = data.split(" ",1)
  473. if (!cmd.length) {
  474. return
  475. }
  476. var cmd = cmd[0]
  477. if (cmd == "stats") {
  478. var cpuLoad = parseFloat(data.substr(cmd.length+1).split(" ",2)[0])
  479. if (cpuLoad != cached_cpuLoad) {
  480. cached_cpuLoad = cpuLoad
  481. $("#info-dsp-load").text(""+cpuLoad.toString()+"%")
  482. }
  483. return
  484. }
  485. if (cmd == "ping") {
  486. ws.send("pong")
  487. return
  488. }
  489. if (cmd == "stop") {
  490. ws.close()
  491. return
  492. }
  493. if (cmd == "bufsize") {
  494. var bufsize = data.substr(cmd.length+1)
  495. $("#info-dsp-buffer-size").html(bufsize)
  496. set_buffer_size_radio(bufsize)
  497. return
  498. }
  499. if (cmd == "cc-device-updated") {
  500. $('#cc-device-update-window').hide()
  501. new Notification("info", "Control Chain device firmware update complete!")
  502. return
  503. }
  504. }
  505. // ----------------------------------------------------------------------------------------------------------------
  506. // tab "tab-xyz" shows page "settings-page-xyz"
  507. $(".add-bank").click(function () {
  508. // hide all
  509. $(".add-bank").removeClass("selected")
  510. $(".settings-page").hide()
  511. // show the one that was clicked
  512. $(this).addClass("selected")
  513. $("#settings-page-" + this.id.replace("tab-", "")).show()
  514. $(".settings-page-content").scrollTop(0)
  515. })
  516. // ----------------------------------------------------------------------------------------------------------------
  517. $('#cc-device-update-window').find('.js-cancel').click(function () {
  518. $.ajax({
  519. url: '/controlchain/cancel/',
  520. type: 'POST',
  521. success: function () {
  522. $('#cc-device-update-window').hide()
  523. },
  524. error: function () {
  525. $('#cc-device-update-window').hide()
  526. },
  527. cache: false,
  528. dataType: 'json'
  529. })
  530. return false
  531. })
  532. // ----------------------------------------------------------------------------------------------------------------
  533. refresh_sysinfo()
  534. refresh_sysprefs()
  535. // User Interface tools: each one on its own. One never set on its own follows its data-fallback key if
  536. // that was set (Install All / Update All were one switch), then the old Developer Mode switch.
  537. $(".prefs-ui-tool").each(function () {
  538. var value = PREFERENCES[$(this).data("key")]
  539. if (value !== "on" && value !== "off" && $(this).data("fallback")) {
  540. value = PREFERENCES[$(this).data("fallback")]
  541. }
  542. if (value !== "on" && value !== "off") {
  543. value = PREFERENCES['dev-mode']
  544. }
  545. $(this).prop("checked", value == "on")
  546. })
  547. // CPU speed and temperature are not available on the Duo
  548. if (PLATFORM == "duo") {
  549. $(".prefs-ui-cpu-stats-option").hide()
  550. }
  551. if (PREFERENCES['show-unstable-plugins'] == "true") {
  552. $("#prefs-ui-unstable-plugins").prop("checked", true)
  553. }
  554. if (PREFERENCES['update-channel'] == "testing") {
  555. $("#prefs-update-channel-testing").prop("checked", true)
  556. $("#prefs-update-channel-note").show()
  557. } else {
  558. $("#prefs-update-channel-stable").prop("checked", true)
  559. }
  560. if (PREFERENCES['merge-stereo-cables'] == "true") {
  561. $("#prefs-ui-stereo-cables").prop("checked", true)
  562. }
  563. var teleportScale = parseFloat(PREFERENCES['teleport-label-scale'])
  564. if (! (teleportScale > 0)) {
  565. teleportScale = 1
  566. }
  567. $("#prefs-ui-teleport-scale").val(teleportScale)
  568. $("#prefs-ui-teleport-scale-value").text(teleportScale.toFixed(1) + "x")
  569. if (! HMI_EEPROM) {
  570. $("#prefs-delete-hmi-settings_br").hide()
  571. $("#prefs-delete-hmi-settings_label").hide()
  572. }
  573. // ----------------------------------------------------------------------------------------------------------------
  574. // --- Personal :: Bluetooth custom name
  575. this.last_bluetooth_timeout = null
  576. this.set_bluetooth_name = function() {
  577. if (self.last_bluetooth_timeout != null) {
  578. clearTimeout(self.last_bluetooth_timeout)
  579. self.last_bluetooth_timeout = null
  580. }
  581. var name
  582. if ($("#prefs-bluetooth-custom").prop("checked")) {
  583. name = $("#prefs-bluetooth-name").val()
  584. } else {
  585. name = ""
  586. }
  587. write_file_contents("bluetooth/name", name)
  588. }
  589. $("#prefs-bluetooth-custom").click(function () {
  590. var elem_btname = $("#prefs-bluetooth-name")
  591. if ($(this).prop("checked")) {
  592. // give it a default name if one was not set before
  593. if (! elem_btname.val()) {
  594. elem_btname.val(INFO.hwname)
  595. }
  596. // enable text input
  597. elem_btname.prop("disabled", false)
  598. } else {
  599. // disable text input
  600. elem_btname.prop("disabled", true)
  601. }
  602. // set name
  603. self.set_bluetooth_name()
  604. })
  605. $("#prefs-bluetooth-name")
  606. .keydown(function (e) {
  607. if (e.keyCode == 13) {
  608. // detect enter
  609. self.set_bluetooth_name()
  610. return false
  611. } else if (e.keyCode == 8 || e.keyCode == 46) {
  612. if (self.last_bluetooth_timeout != null) {
  613. clearTimeout(self.last_bluetooth_timeout)
  614. }
  615. // detect delete and backspace
  616. self.last_bluetooth_timeout = setTimeout(function () {
  617. self.set_bluetooth_name()
  618. }, 400)
  619. }
  620. })
  621. .keypress(function (e) { // keypress won't detect delete and backspace but will only allow inputable keys
  622. if (e.which == 13) {
  623. return
  624. }
  625. if (self.last_bluetooth_timeout != null) {
  626. clearTimeout(self.last_bluetooth_timeout)
  627. }
  628. self.last_bluetooth_timeout = setTimeout(function () {
  629. self.set_bluetooth_name()
  630. }, 400)
  631. })
  632. // ----------------------------------------------------------------------------------------------------------------
  633. // --- Backup & Restore
  634. // "<device configs>,<plugins>,<user files>,<browser time>"
  635. // The browser's time dates the backup (and the safety copy of a restore): the Dwarf has no
  636. // battery-backed clock and would write 1970.
  637. function backup_options() {
  638. return ($("#prefs-backup-configs").prop("checked") ? '1' : '0') + ","
  639. + ($("#prefs-backup-plugins").prop("checked") ? '1' : '0') + ","
  640. + ($("#prefs-backup-userfiles").prop("checked") ? '1' : '0') + ","
  641. + Math.floor(Date.now() / 1000)
  642. }
  643. $("#button-action-backup-export").click(function () {
  644. var block = show_blocker("export")
  645. run_custom_command("backup-export " + backup_options(), function (resp) {
  646. block.remove()
  647. if (resp.ok) {
  648. new Notification("info", "Backup to USB stick complete!<br>You can now safely remove the USB stick.")
  649. } else {
  650. new Notification("error", "Backup to USB stick failed!<br>" + resp.error)
  651. }
  652. }, function () {
  653. block.remove()
  654. new Notification("error", "Backup to USB stick failed!<br>Communication failure.")
  655. })
  656. })
  657. $("#button-action-backup-import").click(function () {
  658. var block = show_blocker("info")
  659. run_custom_command("backup-info", function (resp) {
  660. block.remove()
  661. if (! resp.ok) {
  662. new Notification("error", "Cannot read a backup from the USB stick.<br>" + resp.error)
  663. return
  664. }
  665. if (! confirm(backup_restore_question(resp.info))) {
  666. return
  667. }
  668. start_backup_restore()
  669. }, function () {
  670. block.remove()
  671. new Notification("error", "Cannot read a backup from the USB stick.<br>Communication failure.")
  672. })
  673. })
  674. function backup_restore_question(info) {
  675. var opts = info.options || {},
  676. sizes = info.sizes || {},
  677. mb = function (bytes) { return Math.max(1, Math.round((bytes || 0) / 1048576)) + " MB" },
  678. created = info.created ? new Date(info.created) : null,
  679. text = "Backup found on the USB stick:\n"
  680. // a date before 2020 comes from a unit whose clock was not set (1970)
  681. if (created && (isNaN(created.getTime()) || created.getFullYear() < 2020)) {
  682. created = null
  683. }
  684. text += " made on " + (created ? created.toLocaleString() : "an unknown date")
  685. if (info.release) {
  686. text += " with MOD OS " + info.release
  687. }
  688. text += "\n pedalboards, banks, settings and presets (" + mb(sizes.user) + ")\n"
  689. if (opts.plugins) {
  690. text += " LV2 plugins (" + mb(sizes.plugins) + ")\n"
  691. }
  692. if (opts.device_configs) {
  693. text += " device configs (" + mb(sizes.device) + ")\n"
  694. }
  695. if (opts.user_files) {
  696. text += " user files (" + mb(sizes.files) + ")\n"
  697. }
  698. text += "\nThe restore replaces the pedalboards, banks, settings and presets on this MOD"
  699. if ($("#prefs-backup-configs").prop("checked") && opts.device_configs) {
  700. text += ", the device configs"
  701. }
  702. if ($("#prefs-backup-userfiles").prop("checked") && opts.user_files) {
  703. text += ", the user files"
  704. }
  705. text += ". Plugins and licences are only added, never removed. "
  706. + "The current data is kept aside on the MOD until the next restore.\n"
  707. if ($("#prefs-backup-userfiles").prop("checked") && ! opts.user_files) {
  708. text += "\nThis backup has no user files: the user files on this MOD stay as they are.\n"
  709. }
  710. if ($("#prefs-backup-configs").prop("checked") && ! opts.device_configs) {
  711. text += "\nThis backup has no device configs: the current ones stay as they are.\n"
  712. }
  713. if (info.format === 0) {
  714. text += "\nThis backup was made before MOD OS 1.15.\n"
  715. }
  716. return text + "\nContinue?"
  717. }
  718. function start_backup_restore() {
  719. var block = show_blocker("import")
  720. run_custom_command("backup-import " + backup_options(), function (resp) {
  721. if (resp.ok) {
  722. block.html('<p>Restore from USB stick complete!<br/>'
  723. +'The MOD now restarts its audio and web interface: reload this page in a few seconds.</p>')
  724. var re = $("<div class='button icon'>Reload</div>").appendTo(block);
  725. re.css("background-image", "url(img/icons/25/reload.png)");
  726. re.click(function () { location.reload(); });
  727. } else {
  728. block.html('<p>Restore from USB stick failed!<br/>' + resp.error + '</p>')
  729. var cl = $("<div class='button icon'>Close</div>").appendTo(block);
  730. cl.click(function () { block.remove(); });
  731. }
  732. }, function () {
  733. block.html('<p>Restore from USB stick: lost contact with the MOD.<br/>Reload this page in a few seconds.</p>')
  734. var re = $("<div class='button icon'>Reload</div>").appendTo(block);
  735. re.click(function () { location.reload(); });
  736. })
  737. }
  738. // ----------------------------------------------------------------------------------------------------------------
  739. // --- Boot & Restore
  740. $("#button-action-reboot").click(function () {
  741. ws.close()
  742. run_custom_command("reboot")
  743. })
  744. $("#button-action-reboot-needed").click(function () {
  745. $("#button-action-reboot").click()
  746. })
  747. $("#button-action-restore").click(function () {
  748. run_custom_command("restore")
  749. })
  750. // ----------------------------------------------------------------------------------------------------------------
  751. // --- Audio Server
  752. // the server persists the buffer size for the next boot itself (/data/jack-buffer-size + the marker files)
  753. $("input[name=prefs-audio-buffer-size]").change(function () {
  754. var bufferSize = $(this).val()
  755. $.ajax({
  756. url: '/set_buffersize/' + bufferSize,
  757. method: 'POST',
  758. cache: false,
  759. success: function (resp) {
  760. if (! resp.ok) {
  761. set_buffer_size_radio(resp.size)
  762. new Notification('error', 'Could not change the buffer size to ' + bufferSize + ' frames', 5000)
  763. }
  764. },
  765. error: function () {
  766. set_buffer_size_radio($("#info-dsp-buffer-size").text())
  767. new Notification('error', 'Could not change the buffer size: communication failure', 5000)
  768. },
  769. })
  770. })
  771. $("#prefs-audio-mono-copy").click(function () {
  772. create_or_delete_file("jack-mono-copy", $(this).prop("checked"))
  773. })
  774. $("#prefs-audio-separate-spdif-outs").click(function () {
  775. create_or_delete_file("separate-spdif-outs", $(this).prop("checked"))
  776. })
  777. // ----------------------------------------------------------------------------------------------------------------
  778. // --- Update channel
  779. // Stored as a preference only. Nothing reads it yet: the device does not send a channel
  780. // when it checks for updates (the server derives the group from the device registration),
  781. // so this switch becomes effective once the update service exposes a self-service group.
  782. $("input[name=prefs-update-channel]").click(function () {
  783. var channel = $(this).val()
  784. config_set("update-channel", channel)
  785. if (channel == "testing") {
  786. $("#prefs-update-channel-note").show()
  787. } else {
  788. $("#prefs-update-channel-note").hide()
  789. }
  790. })
  791. // --- Report a problem
  792. var problemReport = new ProblemReport({
  793. version: '{{version}}',
  794. feedbackUrl: '{{feedback_url}}',
  795. })
  796. $("#button-action-report").click(function () {
  797. problemReport.open()
  798. })
  799. // --- User Interface
  800. $(".prefs-ui-tool").click(function () {
  801. config_set($(this).data("key"), $(this).prop("checked") ? "on" : "off")
  802. })
  803. $("#prefs-ui-unstable-plugins").click(function () {
  804. config_set("show-unstable-plugins", bool2str($(this).prop("checked")))
  805. })
  806. $("#prefs-ui-stereo-cables").click(function () {
  807. config_set("merge-stereo-cables", bool2str($(this).prop("checked")))
  808. })
  809. // Readout follows the drag, value saved once on release -- a debounce on `input`
  810. // would drop the save if the page is left inside its window. No live preview: this is
  811. // a standalone page with no pedalboard in it, so the size applies on the next load.
  812. $("#prefs-ui-teleport-scale").on("input", function () {
  813. $("#prefs-ui-teleport-scale-value").text((parseFloat($(this).val()) || 1).toFixed(1) + "x")
  814. })
  815. $("#prefs-ui-teleport-scale").on("change", function () {
  816. config_set("teleport-label-scale", String(parseFloat($(this).val()) || 1))
  817. })
  818. // ----------------------------------------------------------------------------------------------------------------
  819. // --- Services
  820. $("#prefs-service-netmanager").click(function () {
  821. enable_service("netmanager", $(this).prop("checked"), false, true)
  822. })
  823. // ----------------------------------------------------------------------------------------------------------------
  824. // --- Workarounds
  825. $("#prefs-workarounds-autorestart-hmi").click(function () {
  826. create_or_delete_file("autorestart-hmi", $(this).prop("checked"), true)
  827. })
  828. // ----------------------------------------------------------------------------------------------------------------
  829. // --- Cleanup
  830. $("#button-action-delete").attr('disabled', true)
  831. var deleteEnabled = function() {
  832. var ok = $("#prefs-delete-confirm").val().toUpperCase() == "DELETE";
  833. var favorites = !!$("#prefs-delete-favorites").prop('checked');
  834. var hmiSettings = !!$("#prefs-delete-hmi-settings").prop('checked');
  835. var licenseKeys = !!$("#prefs-delete-license-keys").prop('checked');
  836. var banks = !!$("#prefs-delete-banks").prop('checked');
  837. var pedalboards = !!$("#prefs-delete-pedalboards").prop('checked');
  838. var plugins = !!$("#prefs-delete-plugins").prop('checked');
  839. var title = '';
  840. if (!favorites && !hmiSettings && !licenseKeys && !banks && !pedalboards && !plugins) {
  841. title = "You need to check at least one checkbox above";
  842. } else if (!ok) {
  843. title = 'You need type "DELETE" on the input above to confirm data removal';
  844. }
  845. var disabled = !ok || (!favorites && !hmiSettings && !licenseKeys && !banks && !pedalboards && !plugins);
  846. $("#button-action-delete").attr('disabled', disabled);
  847. $("#button-action-delete").attr('title', title);
  848. }
  849. $("#prefs-delete-confirm").change(deleteEnabled);
  850. $("#prefs-delete-confirm").keyup(deleteEnabled);
  851. $("#prefs-delete-favorites").click(deleteEnabled);
  852. $("#prefs-delete-hmi-settings").click(deleteEnabled);
  853. $("#prefs-delete-license-keys").click(deleteEnabled);
  854. $("#prefs-delete-banks").click(deleteEnabled);
  855. $("#prefs-delete-pedalboards").click(deleteEnabled);
  856. $("#prefs-delete-plugins").click(deleteEnabled);
  857. deleteEnabled();
  858. $("#button-action-delete").click(function() {
  859. var favorites = !!$("#prefs-delete-favorites").prop('checked');
  860. var hmiSettings = !!$("#prefs-delete-hmi-settings").prop('checked');
  861. var licenseKeys = !!$("#prefs-delete-license-keys").prop('checked');
  862. var banks = !!$("#prefs-delete-banks").prop('checked');
  863. var pedalboards = !!$("#prefs-delete-pedalboards").prop('checked');
  864. var plugins = !!$("#prefs-delete-plugins").prop('checked');
  865. var block = show_blocker("delete");
  866. system_cleanup(favorites, hmiSettings, licenseKeys, banks, pedalboards, plugins, function (resp) {
  867. if (resp.ok) {
  868. setTimeout(function () {
  869. block.html('<p>Delete operation complete!</p>')
  870. var re = $("<div class='button icon'>Reload</div>").appendTo(block);
  871. re.css("background-image", "url(img/icons/25/reload.png)");
  872. re.click(function () { location.reload(); });
  873. }, 1000)
  874. } else {
  875. block.html('<p>Delete operation failed!<br/>' + resp.error + '</p>')
  876. }
  877. })
  878. });
  879. $("#form-action-delete").click(function() {
  880. if ($("#prefs-delete-confirm").val().toUpperCase() == "DELETE") {
  881. $("#button-action-delete").click();
  882. }
  883. return false;
  884. });
  885. // ----------------------------------------------------------------------------------------------------------------
  886. // --- HMI Reflash
  887. $("#button-action-reflash").attr('disabled', true)
  888. var reflashEnabled = function() {
  889. var ok = $("#prefs-reflash-confirm").val().toUpperCase() == "REFLASH";
  890. var title = '';
  891. if (!ok) {
  892. title = 'You need type "REFLASH" on the input above to confirm Controller reflash';
  893. }
  894. $("#button-action-reflash").attr('disabled', !ok);
  895. $("#button-action-reflash").attr('title', title);
  896. }
  897. $("#prefs-reflash-confirm").change(reflashEnabled);
  898. $("#prefs-reflash-confirm").keyup(reflashEnabled);
  899. reflashEnabled();
  900. $("#button-action-reflash").click(function() {
  901. var block = show_blocker("reflash");
  902. var checkAlive = function() {
  903. $.ajax({
  904. url: '/hello',
  905. method: 'GET',
  906. cache: false,
  907. global: false,
  908. timeout: 1000,
  909. success: function() {
  910. block.html('<p>Controller reflash complete!</p>')
  911. var re = $("<div class='button icon'>Reload</div>").appendTo(block);
  912. re.css("background-image", "url(img/icons/25/reload.png)");
  913. re.click(function () { location.reload(); });
  914. },
  915. error: function() {
  916. setTimeout(checkAlive, 2000);
  917. },
  918. })
  919. }
  920. // Check if mod-ui is alive after 30 seconds
  921. setTimeout(checkAlive, 30000);
  922. enable_service("hmi-update", true, false, false);
  923. });
  924. $("#form-action-reflash").click(function() {
  925. if ($("#prefs-reflash-confirm").val().toUpperCase() == "REFLASH") {
  926. $("#button-action-reflash").click();
  927. }
  928. return false;
  929. });
  930. // ----------------------------------------------------------------------------------------------------------------
  931. // --- Device Updates
  932. var deviceUpdatesRespDev, deviceUpdatesRespVer
  933. $.ajax({
  934. method: 'GET',
  935. url: CONTROLCHAIN_URL + '/devices',
  936. success: function (resp) {
  937. deviceUpdatesRespDev = resp
  938. refresh_device_updates(deviceUpdatesRespDev, deviceUpdatesRespVer)
  939. },
  940. error: function () {
  941. console.log("Error: failed to get devices information")
  942. report_device_updates_failed()
  943. },
  944. cache: false,
  945. dataType: 'json'
  946. })
  947. $.ajax({
  948. method: 'GET',
  949. url: CONTROLCHAIN_URL + '/versions',
  950. success: function (resp) {
  951. deviceUpdatesRespVer = resp
  952. refresh_device_updates(deviceUpdatesRespDev, deviceUpdatesRespVer)
  953. },
  954. error: function () {
  955. report_device_updates_failed()
  956. },
  957. cache: false,
  958. dataType: 'json'
  959. })
  960. // ----------------------------------------------------------------------------------------------------------------
  961. // start code for ajax loading bar
  962. NProgress.configure({
  963. template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
  964. });
  965. $(document)
  966. .ajaxStart(function(data) {
  967. NProgress.start();
  968. })
  969. .ajaxComplete(function() {
  970. NProgress.done();
  971. });
  972. // end code for ajax loading bar
  973. })
  974. </script>
  975. <script type="text/javascript" src="js/templates.js?v={{version}}"></script>
  976. <script type="text/javascript" src="js/common.js?v={{version}}"></script>
  977. <script type="text/javascript" src="js/file_transfer.js?v={{version}}"></script>
  978. <script type="text/javascript" src="js/window.js?v={{version}}"></script>
  979. <script type="text/javascript" src="js/modgui.js?v={{version}}"></script>
  980. <script type="text/javascript" src="js/notification.js?v={{version}}"></script>
  981. <script type="text/javascript" src="js/nprogress.js?v={{version}}"></script>
  982. <script type="text/javascript" src="js/report.js?v={{version}}"></script>
  983. </head>
  984. <!-- END HEAD -->
  985. <!-- BODY -->
  986. <body class="mod-dark">
  987. <!-- PRELOAD -->
  988. <div class="mod-hidden">
  989. <img src="img/icons/blocked.svg" alt=""/>
  990. <img src="img/icons/25/reload.png" width="25px" height="25px" alt=""/>
  991. </div>
  992. <!-- END PRELOAD -->
  993. <!-- NOTIFICATIONS -->
  994. <div id="notifications" class="mod-hidden"></div>
  995. <!-- END NOTIFICATIONS -->
  996. <!-- WRAPPER -->
  997. <div id="wrapper">
  998. <!-- BANKS|SETTINGS -->
  999. <div id="bank-library">
  1000. <div class="box clearfix">
  1001. <header>
  1002. <h1 class="bottom top">MOD Settings</h1>
  1003. </header>
  1004. <div class="pedalboards clearfix js-pedalboards"></div>
  1005. </div>
  1006. <!-- BANK|SETTINGS-LIST -->
  1007. <div id="bank-list">
  1008. <div id="tab-device" class="add-bank selected">Device</div>
  1009. <div id="tab-audio" class="add-bank">Audio</div>
  1010. <div id="tab-ui" class="add-bank">User Interface</div>
  1011. <div id="tab-updates" class="add-bank">Updates</div>
  1012. <div id="tab-backup" class="add-bank">Backup &amp; Restore</div>
  1013. <div id="tab-developer" class="add-bank">Developer</div>
  1014. <div id="tab-maintenance" class="add-bank">Maintenance</div>
  1015. <a href="/" id="go-back"><span class="icon-return"></span>Go back</a>
  1016. </div>
  1017. <!-- END BANK|SETTINGS-LIST -->
  1018. <!-- SETTINGS PAGES -->
  1019. <div class="settings-page-content">
  1020. <!-- REBOOT NEEDED -->
  1021. <div id="settings-reboot-needed" class="mod-hidden">
  1022. <input type="button" id="button-action-reboot-needed" value="Reboot MOD"></input>
  1023. <b>Reboot needed.</b> Some of the changes you made only take effect after a reboot.<br/>
  1024. Note that all unsaved pedalboard changes will be lost.
  1025. </div>
  1026. <!-- END REBOOT NEEDED -->
  1027. <!-- SETTINGS PAGE (DEVICE) -->
  1028. <div class="settings-page" id="settings-page-device">
  1029. <h1>System Information</h1>
  1030. <form class="form">
  1031. <h2>System</h2>
  1032. <p>
  1033. <b>Unit:</b> <span id="info-system-unit">---</span><br/>
  1034. <b>Build Date:</b> <span id="info-system-date">---</span><br/>
  1035. <b>OS Version:</b> {{version}}<br/>
  1036. </p>
  1037. <h2>Kernel</h2>
  1038. <p>
  1039. <b>Machine:</b> <span id="info-kernel-machine">---</span><br/>
  1040. <b>Release:</b> <span id="info-kernel-release">---</span><br/>
  1041. <b>Version:</b> <span id="info-kernel-version">---</span><br/>
  1042. </p>
  1043. <h2>Audio</h2>
  1044. <p>
  1045. <b>Buffer Size:</b> <span id="info-dsp-buffer-size">{{bufferSize}}</span> frames<br/>
  1046. <b>Sample Rate:</b> {{sampleRate}} Hz<br/>
  1047. <b>DSP Load:</b> <span id="info-dsp-load">--.- %</span><br/>
  1048. </p>
  1049. </form>
  1050. <h1>Bluetooth</h1>
  1051. <form class="form">
  1052. <label>
  1053. <input type="checkbox" autocomplete="off" id="prefs-bluetooth-custom">
  1054. Use custom Bluetooth device name: &nbsp;
  1055. </input>
  1056. <input type="text" value="" id="prefs-bluetooth-name" autocomplete="off" disabled></input>
  1057. </label>
  1058. </form>
  1059. <h1>Reboot</h1>
  1060. <form class="form">
  1061. <p>
  1062. <b>Reboot the MOD</b>.<br/>
  1063. Note that all unsaved pedalboard changes will be lost.
  1064. </p>
  1065. <label>
  1066. <input type="button" id="button-action-reboot" value="Reboot MOD"></input>
  1067. </label>
  1068. </form>
  1069. </div>
  1070. <!-- END SETTINGS PAGE (DEVICE) -->
  1071. <!-- SETTINGS PAGE (AUDIO) -->
  1072. <div class="settings-page mod-hidden" id="settings-page-audio">
  1073. <h1>Outputs</h1>
  1074. <form class="form">
  1075. <label>
  1076. <input type="checkbox" autocomplete="off" id="prefs-audio-mono-copy">
  1077. Copy mono output buffer to unused channel
  1078. </input>
  1079. </label>
  1080. <p>
  1081. Automatically copy the audio data from an unconnected output to another.<br/>
  1082. With this enabled, the 2 outputs will receive the same data if one of them is unconnected.<br/>
  1083. Takes effect after a reboot.
  1084. </p>
  1085. <div id="prefs-audio-separate-spdif-outs_div">
  1086. <label>
  1087. <input type="checkbox" autocomplete="off" id="prefs-audio-separate-spdif-outs">
  1088. Separate S/PDIF outputs
  1089. </input>
  1090. </label>
  1091. <p>
  1092. The Duo X S/PDIF outputs can be set to mirror the analog output or be treated independently.<br/>
  1093. Mirror mode is default, where S/PDIF will contain the same audio signal as the analog outputs.<br/>
  1094. Enable this option to have 2 extra outputs on your pedalboard.<br/>
  1095. Takes effect after a reboot.
  1096. </p>
  1097. </div>
  1098. </form>
  1099. <h1>Buffer Size</h1>
  1100. <form class="form">
  1101. <div id="prefs-audio-buffer-size">
  1102. {% for size in bufferSizes %}
  1103. <label>
  1104. <input type="radio" autocomplete="off" name="prefs-audio-buffer-size" value="{{size}}"{% if size == bufferSize %} checked{% end %}>
  1105. {{size}} frames{% if size == 128 %} (default){% end %}
  1106. </input>
  1107. </label>
  1108. {% end %}
  1109. </div>
  1110. <p>
  1111. MOD runs at 128 frames by default.<br/>
  1112. 256 frames gives plugins twice the time per cycle, at the cost of doubling the latency: use it if you need the extra headroom.<br/>
  1113. {% if 64 in bufferSizes %}
  1114. 64 frames halves the latency but leaves plugins half the time per cycle: a pedalboard that runs fine at 128 frames can drop out at 64.<br/>
  1115. {% end %}
  1116. Changing the buffer size restarts the audio and reloads the current pedalboard; unsaved changes are kept.
  1117. </p>
  1118. </form>
  1119. </div>
  1120. <!-- END SETTINGS PAGE (AUDIO) -->
  1121. <!-- SETTINGS PAGE (UPDATES) -->
  1122. <div class="settings-page mod-hidden" id="settings-page-updates">
  1123. <h1>MOD OS</h1>
  1124. <form class="form">
  1125. <p>
  1126. <b>Installed version:</b> {{version}}<br/>
  1127. Updates are offered on the main screen: when a new release is available for this unit,
  1128. the update icon in the bottom bar tells you so. Click it to download and install.
  1129. </p>
  1130. <p>
  1131. <b>Update channel</b>.<br/>
  1132. Stable receives final releases only. Testing also receives release candidates
  1133. before they become final, so you can try new features early and report problems.
  1134. </p>
  1135. <label>
  1136. <input type="radio" name="prefs-update-channel" value="stable" id="prefs-update-channel-stable" autocomplete="off">
  1137. Stable
  1138. </input>
  1139. </label>
  1140. <label>
  1141. <input type="radio" name="prefs-update-channel" value="testing" id="prefs-update-channel-testing" autocomplete="off">
  1142. Testing
  1143. </input>
  1144. </label>
  1145. <p id="prefs-update-channel-note" class="mod-hidden">
  1146. Note: the update server does not honour this setting yet. Testing releases are currently
  1147. offered to registered devices only, or installed manually from the announcement.
  1148. </p>
  1149. </form>
  1150. <h1>Manual Update</h1>
  1151. <form class="form">
  1152. <p>
  1153. <b>Start the MOD's restore/update mode</b>, where you can manually update the MOD via
  1154. USB Mass Storage mode.<br/>
  1155. Note that all unsaved pedalboard changes will be lost.
  1156. </p>
  1157. <label>
  1158. <input type="button" id="button-action-restore" value="Start update mode"></input>
  1159. </label>
  1160. </form>
  1161. <h1>Control Chain Firmware</h1>
  1162. <form class="form" id="settings-cc-firmware">
  1163. <p id="settings-cc-firmware-status">
  1164. Looking for Control Chain firmware updates...
  1165. </p>
  1166. </form>
  1167. </div>
  1168. <!-- END SETTINGS PAGE (UPDATES) -->
  1169. <!-- SETTINGS PAGE (BACKUP & RESTORE) -->
  1170. <div class="settings-page mod-hidden" id="settings-page-backup">
  1171. <h1>Backup &amp; Restore</h1>
  1172. <form class="form">
  1173. <p>
  1174. <b>Backup and restore user data using a USB stick</b>.<br/>
  1175. A backup always holds your pedalboards, banks, settings and plugin presets, plus the parts you tick below.
  1176. The previous backup on the stick is kept until the new one is complete.<br/>
  1177. A restore replaces the pedalboards, banks, settings and presets on this MOD (and the ticked parts
  1178. that the backup holds). Plugins and licences are only added, never removed.
  1179. The data a restore replaces is kept aside on the MOD until the next restore.<br/>
  1180. The USB stick needs enough free space. A FAT32 stick holds at most 4 GB per part (plugins, user files):
  1181. above that, leave the part out or, on a MOD Dwarf, use a stick formatted as exFAT.
  1182. </p>
  1183. <label>
  1184. <input type="checkbox" autocomplete="off" id="prefs-backup-configs">
  1185. Also backup/restore device configs (audio gains, bluetooth config, etc)
  1186. </input>
  1187. </label>
  1188. <br/>
  1189. <label>
  1190. <input type="checkbox" autocomplete="off" id="prefs-backup-plugins">
  1191. Also backup/restore LV2 plugins
  1192. </input>
  1193. </label>
  1194. <br/>
  1195. <label>
  1196. <input type="checkbox" autocomplete="off" id="prefs-backup-userfiles">
  1197. Also backup/restore user files (NAM models, IRs, audio loops, samples, etc)
  1198. </input>
  1199. </label>
  1200. <br/>
  1201. <label>
  1202. <input type="button" id="button-action-backup-export" value="Backup user data..."></input>
  1203. </label>
  1204. <label>
  1205. <input type="button" id="button-action-backup-import" value="Restore user data..."></input>
  1206. </label>
  1207. </form>
  1208. </div>
  1209. <!-- END SETTINGS PAGE (BACKUP & RESTORE) -->
  1210. <!-- SETTINGS PAGE (USER INTERFACE) -->
  1211. <div class="settings-page mod-hidden" id="settings-page-ui">
  1212. <h1>Status Bar</h1>
  1213. <form class="form">
  1214. <label>
  1215. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-xruns" data-key="ui-xruns">
  1216. Xrun counter
  1217. </input>
  1218. </label>
  1219. <p>
  1220. Count the audio dropouts (xruns) since the last reset. Click the counter to reset it.
  1221. </p>
  1222. <label>
  1223. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-buffersize" data-key="ui-buffersize">
  1224. Buffer size
  1225. </input>
  1226. </label>
  1227. <p>
  1228. Show the audio buffer size in frames. Click it to change the size; the pedalboard reloads.
  1229. </p>
  1230. <label class="prefs-ui-cpu-stats-option">
  1231. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-cpu-stats" data-key="ui-cpu-stats">
  1232. CPU speed and temperature
  1233. </input>
  1234. </label>
  1235. <p class="prefs-ui-cpu-stats-option">
  1236. Show the processor speed and temperature. Click it to step through the available speeds.
  1237. </p>
  1238. <label>
  1239. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-ping-times" data-key="ui-ping-times">
  1240. Network and controller ping times
  1241. </input>
  1242. </label>
  1243. <p>
  1244. Show how long the unit takes to answer the browser and the controller.
  1245. </p>
  1246. </form>
  1247. <h1>Plugins and Pedalboards</h1>
  1248. <form class="form">
  1249. <label>
  1250. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-store-install-all"
  1251. data-key="ui-store-install-all" data-fallback="ui-store-all">
  1252. Install All in the Plugin Store
  1253. </input>
  1254. </label>
  1255. <p>
  1256. A button to install every plugin shown in the Plugin Store in one go.
  1257. </p>
  1258. <label>
  1259. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-store-update-all"
  1260. data-key="ui-store-update-all" data-fallback="ui-store-all">
  1261. Update All in the Plugin Store
  1262. </input>
  1263. </label>
  1264. <p>
  1265. A button to update every installed plugin that has a new version, in one go.
  1266. </p>
  1267. <label>
  1268. <input type="checkbox" autocomplete="off" class="prefs-ui-tool" id="prefs-ui-share" data-key="ui-share">
  1269. Export and Import of presets and pedalboards
  1270. </input>
  1271. </label>
  1272. <p>
  1273. Export / Import buttons in each plugin's preset list (.modpreset files, for example to send a preset to a
  1274. plugin developer) and in the pedalboard library (.modpedalboard files).
  1275. </p>
  1276. </form>
  1277. <h1>Pedalboard</h1>
  1278. <form class="form">
  1279. <label>
  1280. <input type="checkbox" autocomplete="off" id="prefs-ui-stereo-cables">
  1281. Merge stereo cables
  1282. </input>
  1283. </label>
  1284. <p>
  1285. Draw the two halves of a stereo connection as a single cable, instead of
  1286. one per channel. Pairs wired straight across are merged, and so are a mono
  1287. output into both halves of a stereo input and a stereo output into one mono
  1288. input; a left/right swap stays as two cables so it remains visible. Off by
  1289. default.
  1290. </p>
  1291. <label>
  1292. Teleport label size
  1293. <input type="range" autocomplete="off" id="prefs-ui-teleport-scale"
  1294. min="0.6" max="2" step="0.1" style="vertical-align:middle;width:160px">
  1295. <span id="prefs-ui-teleport-scale-value"></span>
  1296. </label>
  1297. <p>
  1298. How large the label boxes on a split cable are drawn.
  1299. </p>
  1300. </form>
  1301. <p class="prefs-ui-note">
  1302. These options apply when you go back to the main screen.
  1303. </p>
  1304. </div>
  1305. <!-- END SETTINGS PAGE (USER INTERFACE) -->
  1306. <!-- SETTINGS PAGE (DEVELOPER) -->
  1307. <div class="settings-page mod-hidden" id="settings-page-developer">
  1308. <h1>Plugin Store</h1>
  1309. <form class="form">
  1310. <label>
  1311. <input type="checkbox" autocomplete="off" id="prefs-ui-unstable-plugins">
  1312. Show beta plugins in the Store
  1313. </input>
  1314. </label>
  1315. <p>
  1316. Show option to list 'beta' plugins in the Plugin Store.<br/>
  1317. Note that beta plugins can be unstable and cause crashes.
  1318. If you share a pedalboard containing beta plugins, it will only be available to users that explicitly accept pedalboards with beta plugins.<br/>
  1319. Just remember: things can break!
  1320. </p>
  1321. </form>
  1322. <h1>Services</h1>
  1323. <form class="form">
  1324. <p>
  1325. Note: Each additional service you enable consumes a small amount of CPU.<br/>
  1326. Only enable services that you absolutely need.
  1327. </p>
  1328. <label>
  1329. <input type="checkbox" autocomplete="off" id="prefs-service-netmanager"> JACK Net Manager (EXPERIMENTAL)</input>
  1330. </label>
  1331. <br/>
  1332. </form>
  1333. <h1>Workarounds</h1>
  1334. <form class="form">
  1335. <div id="workarounds-autorestart-hmi">
  1336. <label>
  1337. <input type="checkbox" autocomplete="off" id="prefs-workarounds-autorestart-hmi">
  1338. Automatically restart controller screen
  1339. </input>
  1340. </label>
  1341. <p>
  1342. If the controller displays locks up or stops working correctly, we can try to detect this and automatically trigger a restart.<br/>
  1343. This is not completely safe though, false positives can happen and the controller screen might be restarted by mistake.<br/>
  1344. Takes effect after a reboot.
  1345. </p>
  1346. </div>
  1347. </form>
  1348. </div>
  1349. <!-- END SETTINGS PAGE (DEVELOPER) -->
  1350. <!-- SETTINGS PAGE (MAINTENANCE) -->
  1351. <div class="settings-page mod-hidden" id="settings-page-maintenance">
  1352. <h1>Report a problem</h1>
  1353. <form class="form">
  1354. <p>
  1355. <b>Found a bug, or something that does not behave as it should?</b><br/>
  1356. This collects the system details a good report needs, for you to paste into the
  1357. forum topic of this release. Nothing is sent automatically.
  1358. </p>
  1359. <label>
  1360. <input type="button" id="button-action-report" value="Report a problem..."></input>
  1361. </label>
  1362. </form>
  1363. <h1>Reflash controller</h1>
  1364. <form class="form">
  1365. <p>
  1366. <b>Reinstall the firmware for the controller board.</b><br/>
  1367. This option is here for support reasons; If the power to your device was cut while installing the controller firmware,
  1368. your device may end up in a state where the controller is not fully functional.<br/>
  1369. <br />
  1370. While the reflashing is happening, please DO NOT DISCONNECT THE POWER to the device.<br/>
  1371. There is a RISK OF BRICKING THE DEVICE if the power is cut.
  1372. </p>
  1373. <label>
  1374. To confirm, please type the word "REFLASH": &nbsp;
  1375. <input type="text" id="prefs-reflash-confirm" size="10" style="text-transform: uppercase" autocomplete="off" />
  1376. </label>
  1377. <br/>
  1378. <label>
  1379. <input type="button" id="button-action-reflash" value="Reflash"></input>
  1380. </label>
  1381. <br/>
  1382. <input type="submit" id="form-action-reflash" style="display: none;"></input>
  1383. </form>
  1384. <h1>Delete user data</h1>
  1385. <form class="form">
  1386. <p>
  1387. <b>Delete selected user data from the device.</b><br />
  1388. This will PERMANENTLY DELETE the selected USER DATA. This action is IRREVERSIBLE.
  1389. The device won't work properly until new items are created or installed.
  1390. </p>
  1391. <label>
  1392. <input type="checkbox" autocomplete="off" id="prefs-delete-favorites"> Clear favorite plugin list</input>
  1393. </label>
  1394. <br/>
  1395. <label id="prefs-delete-hmi-settings_label">
  1396. <input type="checkbox" autocomplete="off" id="prefs-delete-hmi-settings"> Clear device settings</input>
  1397. </label>
  1398. <br id="prefs-delete-hmi-settings_br"/>
  1399. <label>
  1400. <input type="checkbox" autocomplete="off" id="prefs-delete-license-keys"> Clear plugin license keys</input>
  1401. </label>
  1402. <br/>
  1403. <label>
  1404. <input type="checkbox" autocomplete="off" id="prefs-delete-banks"> Delete all Banks</input>
  1405. </label>
  1406. <br/>
  1407. <label>
  1408. <input type="checkbox" autocomplete="off" id="prefs-delete-pedalboards"> Delete all Pedalboards</input>
  1409. </label>
  1410. <br/>
  1411. <label>
  1412. <input type="checkbox" autocomplete="off" id="prefs-delete-plugins"> Delete all Plugins</input>
  1413. </label>
  1414. <br/>
  1415. <label>
  1416. To confirm, please type the word "DELETE": &nbsp;
  1417. <input type="text" id="prefs-delete-confirm" autocomplete="off" size="10" style="text-transform: uppercase" />
  1418. </label>
  1419. <br/>
  1420. <label>
  1421. <input type="button" id="button-action-delete" value="Delete"></input>
  1422. </label>
  1423. <br/>
  1424. <input type="submit" id="form-action-delete" style="display: none;"></input>
  1425. </form>
  1426. </div>
  1427. <!-- END SETTINGS PAGE (MAINTENANCE) -->
  1428. </div>
  1429. <!-- END SETTINGS PAGES -->
  1430. <!-- CC DEVICE UPDATE WINDOW -->
  1431. <div id="cc-device-update-window" class="save-popup mod-hidden">
  1432. <div class="mod-box" style="width: 600px; margin:-150px -280px">
  1433. <h1 class="pull-left">Control Chain Device Update</h1><span class="js-cancel close">&times;</span>
  1434. <form class="bottom">
  1435. <div class="clearfix"></div>
  1436. <div id="cc-device-update-text">
  1437. <p>
  1438. Your Control Chain device firmware is ready to be updated.
  1439. </p>
  1440. <p>
  1441. To begin, follow these steps:
  1442. </p>
  1443. <ul>
  1444. <li>Disconnect the device from the Control Chain/Ethernet port</li>
  1445. <li>Hold down the first footswitch on the Control Chain device</li>
  1446. <li>While the first footswitch is down, connect the device to the MOD unit via USB</li>
  1447. <li>Wait for the "update completed" message</li>
  1448. <li>Disconnect the device from the USB port</li>
  1449. <li>Connect it to the Control Chain/Ethernet port once again</li>
  1450. </ul>
  1451. <p>
  1452. Note: The update should only take a few seconds.
  1453. </p>
  1454. </div>
  1455. </form>
  1456. </div>
  1457. </div>
  1458. <!-- END CC DEVICE UPDATE WINDOW -->
  1459. </div>
  1460. <!-- END BANKS|SETTINGS -->
  1461. <!-- END WRAPPER -->
  1462. </div>
  1463. </body>
  1464. <!-- END BODY -->
  1465. </html>