mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-08-07 06:12:22 -04:00
Added page preprocessing
This commit is contained in:
parent
b8e67721b8
commit
a77f423362
3 changed files with 18 additions and 8 deletions
|
@ -3,6 +3,7 @@ import os
|
|||
import time
|
||||
import urwid
|
||||
import nomadnet
|
||||
import subprocess
|
||||
import threading
|
||||
from .MicronParser import markup_to_attrmaps
|
||||
from nomadnet.vendor.Scrollable import *
|
||||
|
@ -488,9 +489,13 @@ class Browser:
|
|||
|
||||
page_data = b"The requested local page did not exist in the file system"
|
||||
if os.path.isfile(page_path):
|
||||
file = open(page_path, "rb")
|
||||
page_data = file.read()
|
||||
file.close()
|
||||
if os.access(page_path, os.X_OK):
|
||||
generated = subprocess.run([page_path], stdout=subprocess.PIPE)
|
||||
page_data = generated.stdout
|
||||
else:
|
||||
file = open(page_path, "rb")
|
||||
page_data = file.read()
|
||||
file.close()
|
||||
|
||||
self.status = Browser.DONE
|
||||
self.page_data = page_data
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue