intermediate: prepare for js api

This commit is contained in:
andreas 2024-10-11 19:23:19 +02:00
parent 09b583ebd6
commit f6e3fa369f
6 changed files with 1976 additions and 1904 deletions

Binary file not shown.

Binary file not shown.

View File

@ -18,6 +18,8 @@ OWN_FILE="extra_script.py"
GEN_DIR='lib/generated'
CFG_FILE='web/config.json'
XDR_FILE='web/xdrconfig.json'
INDEXJS="index.js"
INDEXCSS="index.css"
CFG_INCLUDE='GwConfigDefinitions.h'
CFG_INCLUDE_IMPL='GwConfigDefImpl.h'
XDR_INCLUDE='GwXdrTypeMappings.h'
@ -66,6 +68,7 @@ def isCurrent(infile,outfile):
def compressFile(inFile,outfile):
if isCurrent(inFile,outfile):
return
print("compressing %s"%inFile)
with open(inFile, 'rb') as f_in:
with gzip.open(outfile, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
@ -372,6 +375,16 @@ def getLibs():
rt.append(e)
return rt
def joinFiles(target,pattern,dirlist):
with gzip.open(target,"wb") as oh:
for dir in dirlist:
fn=os.path.join(dir,pattern)
if os.path.exists(fn):
print("adding %s to %s"%(fn,target))
with open(fn,"rb") as rh:
shutil.copyfileobj(rh,oh)
OWNLIBS=getLibs()+["FS","WiFi"]
GLOBAL_INCLUDES=[]
@ -440,6 +453,8 @@ def prebuild(env):
compressFile(mergedConfig,mergedConfig+".gz")
generateCfg(mergedConfig,os.path.join(outPath(),CFG_INCLUDE),False)
generateCfg(mergedConfig,os.path.join(outPath(),CFG_INCLUDE_IMPL),True)
joinFiles(os.path.join(outPath(),INDEXJS+".gz"),INDEXJS,["web"]+userTaskDirs)
joinFiles(os.path.join(outPath(),INDEXCSS+".gz"),INDEXCSS,["web"]+userTaskDirs)
embedded=getEmbeddedFiles(env)
filedefs=[]
for ef in embedded:
@ -453,7 +468,6 @@ def prebuild(env):
filedefs.append((pureName,usname,ct))
inFile=os.path.join(basePath(),"web",pureName)
if os.path.exists(inFile):
print("compressing %s"%inFile)
compressFile(inFile,ef)
else:
print("#WARNING: infile %s for %s not found"%(inFile,ef))

View File

@ -351,7 +351,7 @@
"check": "checkMinMax",
"min": -1,
"max": 256,
"description": "the temp instance of PGN 130312 used for water temperature, use -1 for none, 256 for any",
"description": "the temp instance of PGN 130312 used for water temperature (0...255), use -1 for none, 256 for any",
"default": "256",
"category":"converter"
},

View File

@ -340,4 +340,7 @@ body {
}
.error{
color: red;
}
.changed input.error{
color: red;
}

File diff suppressed because it is too large Load Diff