2020-10-04 21:29:46 +00:00
|
|
|
#!/usr/bin/python3
|
2020-09-19 12:28:56 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# -*- mode: Python -*-
|
|
|
|
'''
|
2020-10-04 21:29:46 +00:00
|
|
|
LJ UI IP updater v0.9.0
|
|
|
|
|
|
|
|
MUST be called from configure.py
|
2020-09-19 12:28:56 +00:00
|
|
|
|
|
|
|
'''
|
|
|
|
|
|
|
|
import os, sys
|
2020-10-04 21:29:46 +00:00
|
|
|
import fileinput
|
|
|
|
from shutil import copyfile
|
2020-09-19 12:28:56 +00:00
|
|
|
ljpath = r'%s' % os.getcwd().replace('\\','/')
|
|
|
|
|
2020-10-04 21:29:46 +00:00
|
|
|
def www(config):
|
|
|
|
global ljpath
|
|
|
|
wwwip = config.get('General','wwwip')
|
|
|
|
wstype = config.get('General','wstype')
|
|
|
|
wsport = config.get('General','wsport')
|
|
|
|
# copy template
|
|
|
|
src = ljpath + "/templates/config.js"
|
|
|
|
dst = ljpath + "/www/config.js"
|
|
|
|
copyfile(src, dst)
|
|
|
|
# Interpolate variables
|
|
|
|
with fileinput.FileInput(dst, inplace=True) as file:
|
|
|
|
for line in file:
|
|
|
|
line = line.replace("%wstype%", wstype)
|
|
|
|
line = line.replace("%wsport%", wsport)
|
|
|
|
line = line.replace("%wwwip%", wwwip)
|
|
|
|
print(line, end='')
|