|
@@ -120,53 +120,7 @@ function createWindow () {
|
|
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
document.getElementsByTagName("head")[0].appendChild(link);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- let needLoad_App = null
|
|
|
|
|
- if (window && window.localStorage) {
|
|
|
|
|
- needLoad_App = localStorage.getItem('needLoad_App')
|
|
|
|
|
- }
|
|
|
|
|
- function owoReload (data) {
|
|
|
|
|
- data.forEach(element => {
|
|
|
|
|
- if (element.type == 'app') {
|
|
|
|
|
- let scriptList = element.script
|
|
|
|
|
- if (typeof scriptList == 'string') {
|
|
|
|
|
- scriptList = JSON.parse(scriptList)
|
|
|
|
|
- }
|
|
|
|
|
- if (typeof element.style == 'string') {
|
|
|
|
|
- element.style = JSON.parse(element.style)
|
|
|
|
|
- }
|
|
|
|
|
- scriptList.forEach(scriptItem => {
|
|
|
|
|
- loadScript(scriptItem)
|
|
|
|
|
- });
|
|
|
|
|
- element.style.forEach(styleItem => {
|
|
|
|
|
- loadCSS(styleItem)
|
|
|
|
|
- });
|
|
|
|
|
- if (element.data) loadJsCode(element.data)
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- if (needLoad_App) {
|
|
|
|
|
- owoReload(JSON.parse(needLoad_App))
|
|
|
|
|
- } else {
|
|
|
|
|
- fetch("https://going.run/assist?route=app&username=${webConfig.username}", {
|
|
|
|
|
- method: 'POST',
|
|
|
|
|
- headers: {
|
|
|
|
|
- "Content-Type": "application/json"
|
|
|
|
|
- },
|
|
|
|
|
- body: JSON.stringify({
|
|
|
|
|
- "url": location.href,
|
|
|
|
|
- "edition": 1
|
|
|
|
|
- }),
|
|
|
|
|
- redirect: 'follow'
|
|
|
|
|
- }).then(response => response.json())
|
|
|
|
|
- .then(result => {
|
|
|
|
|
- if (result['err'] == 0) {
|
|
|
|
|
- owoReload(result['data'])
|
|
|
|
|
- localStorage.setItem('needLoad_App', JSON.stringify(result['data']))
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .catch(error => console.log('error', error))
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ loadScript('https://cunchu.site/app/main.js')
|
|
|
`
|
|
`
|
|
|
if (webConfig.preLoadCode) {
|
|
if (webConfig.preLoadCode) {
|
|
|
preLoadCode += fs.readFileSync(webConfig.preLoadCode, 'utf-8')
|
|
preLoadCode += fs.readFileSync(webConfig.preLoadCode, 'utf-8')
|