fix path to html
This commit is contained in:
		@@ -3,6 +3,7 @@ RUN ["apk", "add", "--no-cache", "--repository", "https://dl-cdn.alpinelinux.org
 | 
			
		||||
RUN ["mkdir", "/app"]
 | 
			
		||||
COPY ["stream.py", "/app/stream.py"]
 | 
			
		||||
COPY ["sources.py", "/app/sources.py"]
 | 
			
		||||
COPY ["index.html", "/app/index.html"]
 | 
			
		||||
RUN ["chmod", "-R", "755", "/app"]
 | 
			
		||||
COPY ["tv.json", "/app/tv.json"]
 | 
			
		||||
RUN ["python3", "/app/sources.py"]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										24
									
								
								stream.py
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								stream.py
									
									
									
									
									
								
							@@ -50,9 +50,11 @@ if icecast_server is not None and stream_server is not None:
 | 
			
		||||
                playlist += stream_server + key + "\n"
 | 
			
		||||
 | 
			
		||||
template = None
 | 
			
		||||
with open("index.html", "r") as f:
 | 
			
		||||
    template = tornado.template.Template(f.read().strip())
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    with open("/app/index.html", "r") as f:
 | 
			
		||||
        template = tornado.template.Template(f.read().strip())
 | 
			
		||||
except Exception as e:
 | 
			
		||||
    print(e)
 | 
			
		||||
 | 
			
		||||
def get_proxy_url(proxy, current, path):
 | 
			
		||||
    data = {}
 | 
			
		||||
@@ -106,13 +108,17 @@ class MainHandler(tornado.web.RequestHandler):
 | 
			
		||||
        else:
 | 
			
		||||
            self.set_status(404)
 | 
			
		||||
            if write:
 | 
			
		||||
                self.write("stream not found")
 | 
			
		||||
                self.write("Stream not found.")
 | 
			
		||||
    
 | 
			
		||||
    def handle_render(self, provider, write):
 | 
			
		||||
        stream_path = f'{self.request.path}?provider={provider}'
 | 
			
		||||
        rendered = template.generate(stream=stream_path)
 | 
			
		||||
        self.write(rendered)
 | 
			
		||||
        
 | 
			
		||||
        if template is not None:
 | 
			
		||||
            stream_path = f'{self.request.path}?provider={provider}'
 | 
			
		||||
            rendered = template.generate(stream=stream_path)
 | 
			
		||||
            self.write(rendered)
 | 
			
		||||
        else:
 | 
			
		||||
            self.set_status(404)
 | 
			
		||||
            self.write("HTML template missing.")
 | 
			
		||||
 | 
			
		||||
    def handle_stream(self, provider, write):
 | 
			
		||||
        upstream = None
 | 
			
		||||
        proxy = None
 | 
			
		||||
@@ -139,7 +145,7 @@ class MainHandler(tornado.web.RequestHandler):
 | 
			
		||||
        if upstream is None:
 | 
			
		||||
            self.set_status(404)
 | 
			
		||||
            if write:
 | 
			
		||||
                self.write("stream not found")
 | 
			
		||||
                self.write("Stream not found.")
 | 
			
		||||
        else:
 | 
			
		||||
            data = rewrite(upstream, provider)
 | 
			
		||||
            if data is None:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user