Merge branch 'master' of github.com:unraid/graphql-api

This commit is contained in:
Alexis Tyler
2020-09-30 13:08:44 +09:30

View File

@@ -593,6 +593,33 @@ response_complete($httpcode, $result, 'success');
</INLINE>
</FILE>
<FILE Name="/usr/local/sbin/flash_backup" Mode="0755">
<INLINE>
<![CDATA[
#!/bin/bash
# This file is /usr/local/sbin/flash_backup
# It is called from within an inotifywait loop like this:
#
# inotifywait -m -r /boot @/boot/.git -e modify -e move -e create -e delete |
# while read path action file; do
# /usr/local/sbin/flash_backup
# done
# use at queue "f" for flash backup
QUEUE=" -q f "
# delete any at jobs in queue f
atq ${QUEUE} | while read line; do
id=`echo ${line} | cut -d " " -f 1`
atrm ${id}
done
# create a new at job in queue f
echo "php /usr/local/emhttp/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php update" | at ${QUEUE} now +1 minute
]]>
</INLINE>
</FILE>
<FILE Name="/usr/local/emhttp/plugins/dynamix.unraid.net/include/UpdateFlashBackup.php">
<INLINE>
<![CDATA[
@@ -825,27 +852,10 @@ response_complete($httpcode, '{}');
#sb-info {display:none}
</style>
<script markdown="0">
function showRegWizard() {
<? $license_state = strtoupper(empty($var['regCheck']) ? $var['regTy'] : $var['regCheck']); ?>
Shadowbox.open({
content:'https://registration.unraid.net/?ts=<?=time()?>&guid=<?=$var['flashGUID']?>&state=<?=$license_state?>&keyfile=<?=str_replace(['+','/','='], ['-','_',''], trim(base64_encode(@file_get_contents($var['regFILE']))))?>&reggen=<?=$var['regGen']?>&flashproduct=<?=$var['flashProduct']?>&flashvendor=<?=$var['flashVendor']?>&registered=<?=empty($remote['apikey'])||empty($var['regFILE'])?0:1?>&servername=<?=$var['NAME']?>&serverip=<?=$_SERVER['SERVER_ADDR']?>&internalip=<?=$_SERVER['SERVER_ADDR']?>&internalport=<?=$_SERVER['SERVER_PORT']?>&protocol=<?=$_SERVER['REQUEST_SCHEME']?>&site='+location.origin+'&email=<?=$remote['email']?>',
player: 'iframe',
options: {modal: true, animate: false, displayNav: false, overlayOpacity: 0.8, viewportPadding: 0, showMovieControls: false}
});
}
function hideRegWizard(cb) {
Shadowbox.close();
$.post('/update.php', {'#file': 'dynamix/dynamix.cfg', '#section': 'wizard', hideWizard: '1'}, cb);
}
function handleMessage(e) {
//if (e.origin != "http://child.com") { return; }
if (e.data.length == 0) { return; }
if (e.data == "CLOSE_SHADOWBOX") {
hideRegWizard();
return;
}
const SAFE_JSON_PARSE = (str) => {
try {
return [null, JSON.parse(str)];
@@ -934,17 +944,14 @@ function handleMessage(e) {
return window.location.reload();
case "REDIRECT_MAIN":
return window.location.href = '/Main';
case "STOP_SENDING_SESSION":
break;
default:
console.error('Unhandled event \'' + data.event + '\' fired. data:', data);
break;
}
}
window.addEventListener('message', handleMessage, false);
<? if (empty($wizard['hideWizard'])) { ?>
$(function() {
setTimeout(function() { showRegWizard(); }, 100);
});
<? } ?>
</script>
]]>
</INLINE>
@@ -1089,6 +1096,13 @@ unraid-user-profile {
<INLINE>
<![CDATA[
<!-- user profile component -->
<?if(empty($wizard['hideWizard']) || $path=='Tools/Registration'):?>
<unraid-launchpad
openonload="<? echo empty($wizard['hideWizard']) ?>"
serverstate="<?=rawurlencode(json_encode($serverstate, JSON_UNESCAPED_SLASHES))?>"
token="<? echo $var['csrf_token'] ?>"
></unraid-launchpad>
<?endif?>
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<?
$upc_dev = 0;
@@ -1171,7 +1185,7 @@ cp -f /usr/local/emhttp/plugins/dynamix/Registration.page /usr/local/emhttp/plug
cat <<EOF >> /usr/local/emhttp/plugins/dynamix/Registration.page
&nbsp;
: <input type="button" value="Open Registration Wizard" onclick="showRegWizard();">
: <unraid-open-launchpad token="<? echo $var['csrf_token'] ?>"></unraid-open-launchpad>
EOF
]]>
</INLINE>