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

View File

@ -351,7 +351,7 @@
"check": "checkMinMax", "check": "checkMinMax",
"min": -1, "min": -1,
"max": 256, "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", "default": "256",
"category":"converter" "category":"converter"
}, },

View File

@ -341,3 +341,6 @@ body {
.error{ .error{
color: red; color: red;
} }
.changed input.error{
color: red;
}

File diff suppressed because it is too large Load Diff