chore:text/plain(#736)
This commit is contained in:
parent
95151a4d9b
commit
20ea5a1b54
@ -2,7 +2,7 @@ import os
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.dirname(sys.path[0]))
|
||||
from flask import Flask, render_template_string
|
||||
from flask import Flask, send_from_directory, make_response
|
||||
from utils.tools import get_result_file_content, get_ip_address, resource_path
|
||||
from utils.config import config
|
||||
import utils.constants as constants
|
||||
@ -15,6 +15,12 @@ def show_index():
|
||||
return get_result_file_content()
|
||||
|
||||
|
||||
@app.route("/favicon.ico")
|
||||
def favicon():
|
||||
return send_from_directory(resource_path('static/images'), 'favicon.ico',
|
||||
mimetype='image/vnd.microsoft.icon')
|
||||
|
||||
|
||||
@app.route("/txt")
|
||||
def show_txt():
|
||||
return get_result_file_content(file_type="txt")
|
||||
@ -38,10 +44,9 @@ def show_log():
|
||||
content = file.read()
|
||||
else:
|
||||
content = constants.waiting_tip
|
||||
return render_template_string(
|
||||
"<head><link rel='icon' href='{{ url_for('static', filename='images/favicon.ico') }}' type='image/x-icon'></head><pre>{{ content }}</pre>",
|
||||
content=content,
|
||||
)
|
||||
response = make_response(content)
|
||||
response.mimetype = "text/plain"
|
||||
return response
|
||||
|
||||
|
||||
def run_service():
|
||||
|
@ -645,6 +645,7 @@ def write_channel_to_file(data, ipv6=False, callback=None):
|
||||
)
|
||||
write_content_into_txt(f"🕘️更新时间,#genre#", path, newline=False)
|
||||
write_content_into_txt(f"{update_time},{update_time_url}", path)
|
||||
write_content_into_txt("", path)
|
||||
for cate, channel_obj in data.items():
|
||||
print(f"\n{cate}:", end=" ")
|
||||
write_content_into_txt(f"{cate},#genre#", path)
|
||||
|
@ -13,7 +13,7 @@ from time import time
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from flask import render_template_string, send_file
|
||||
from flask import send_file, make_response
|
||||
|
||||
import utils.constants as constants
|
||||
from utils.config import config
|
||||
@ -406,10 +406,9 @@ def get_result_file_content(show_content=False, file_type=None):
|
||||
content = file.read()
|
||||
else:
|
||||
content = constants.waiting_tip
|
||||
return render_template_string(
|
||||
"<head><link rel='icon' href='{{ url_for('static', filename='images/favicon.ico') }}' type='image/x-icon'></head><pre>{{ content }}</pre>",
|
||||
content=content,
|
||||
)
|
||||
response = make_response(content)
|
||||
response.mimetype = 'text/plain'
|
||||
return response
|
||||
|
||||
|
||||
def remove_duplicates_from_tuple_list(tuple_list, seen, flag=None, force_str=None):
|
||||
|
Loading…
x
Reference in New Issue
Block a user