mythtv / mythweb Goto Github PK
View Code? Open in Web Editor NEWThe official MythTV mythweb repository
License: Other
The official MythTV mythweb repository
License: Other
I've created a Caddyfile to enable using Caddy2 as the web server, and thought I would share. I'd suggest adding this as mythweb.conf.caddy.
# The Caddyfile is an easy way to configure your Caddy web server.
#
# Unless the file starts with a global options block, the first
# uncommented line is always the address of your site.
#
# To use your own domain name (with automatic HTTPS), first make
# sure your domain's A/AAAA DNS records are properly pointed to
# this machine's public IP, then replace ":80" below with your
# domain name.
# Global options https://caddyserver.com/docs/caddyfile/options
{
auto_https off
admin off
log {
output file /var/log/caddy/caddy.log {
roll_size 50
roll_keep 5
roll_keep_for 2d
}
format console
level INFO
#level DEBUG
}
}
:8080 {
# Set this path to your site's directory.
root * /usr/share/caddy/mythweb
# Add trailing slash for directory requests
@canonicalPath {
file {path}/mythweb.php
not path */
}
redir @canonicalPath {path}/ 308
# Enable the static file server.
file_server
# rewrite rules
@myth_do_nothing {
path_regexp myth_do_nothing_reg ^/(css|data|images|js|themes|skins|[a-z_]+\.(php|pl)).*
}
@myth_perl {
path_regexp myth_perl_reg ^/(pl(/.*)?)$
}
@myth_php {
path_regexp myth_php_reg ^/(.+)$
}
handle @myth_do_nothing {
#do nothing but keep other handlers from running
#rewrite @myth_do_nothing {http.regexp.myth_do_nothing_reg.0}
}
handle @myth_perl {
rewrite @myth_perl /mythweb.pl/{http.regexp.myth_perl_reg.1}
}
handle @myth_php {
rewrite @myth_php /mythweb.php/{http.regexp.myth_php_reg.1}
}
handle * {
rewrite * mythweb.php
}
# Proxy PHP files to the FastCGI responder
@phpFiles path *.php*
reverse_proxy @phpFiles unix//run/php/php7.4-fpm.sock {
transport fastcgi {
split .php
env db_server localhost
env db_name mythconverg
env db_login mythtv
env db_password mythtv
}
}
}
# Refer to the Caddy docs for more information:
# https://caddyserver.com/docs/caddyfile
In modules/mythweb/tmpl/default/set_flvplayer.php the path "/ffmpeg.app" is checked, but then constructed as $path."/ffmpeg".app
https://code.mythtv.org/trac/ticket/12943
Patch to add HTML5 streaming
RFE: Display people in priority order when displaying program details
With MythTV commit bf47572d56 (Include actor roles in cast info) the credits table now maintains the order received from a XMLTV feed(1). The following proposed patch returns the credits in the order specified for display purposes. Because an actor may play multiple characters in certain shows, only return an actor's name once.
diff --git a/modules/tv/classes/Program.php b/modules/tv/classes/Program.php
index 1de5c777..519a8b14 100644
--- a/modules/tv/classes/Program.php
+++ b/modules/tv/classes/Program.php
@@ -565,12 +565,13 @@ class Program extends MythBase {
// No cached value -- load it
if (!isset($this->credits[$role][$add_search_links])) {
// Get the credits for the requested role
- $result = $db->query('SELECT people.name
+ $result = $db->query('SELECT UNIQUE(people.name)
FROM credits, people
WHERE credits.person = people.person
AND credits.role = ?
AND credits.chanid = ?
- AND credits.starttime = FROM_UNIXTIME(?)',
+ AND credits.starttime = FROM_UNIXTIME(?)
+ ORDER BY credits.priority',
$role,
$this->chanid,
$this->starttime
(1) All compliant XMLTV grabbers, per the DTD, are expected to provide the credits in order of billing (to the best of their ability).
Platform: Linux localhost 5.13.12-200.fc34.x86_64 # 1 SMP Wed Aug 18 13:27:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
MythTV version: fixes/31
Package version: Fedora 19.158.20210629git0680b37c68.fc34
Component: mythweb
Everytime
Mythweb connects to backend
Mythweb reports it can not connect:
Error
Unable to connect to the master backend at ::1:6543.
Is it running?
Error
Unable to connect to the master backend at [fe80::xxxx:xxxx:xxxx:xxxx]:6543 (hostname: fe80::::xxxx:xxxx:xxxx:xxxx).
Is it running?
I've seen the error "Session callback expects true/false return value!!"" from includes/session.php sess_write().
Easy fix created in pull request #51.
On a fresh install, I get an empty page of the page mythweb/status
, like http://localhost/mythweb/status/
Visiting the source of that page, I find this statement when retrieving http://localhost/mythweb/status
<div id="content_wrapper">
<!-- Obtained from: http://:6544 -->
</div>
This is caused by mythweb using the obsolete setting of MasterServerIP
in
https://github.com/MythTV/mythweb/blob/92f0f9bc6d15f6d6534e5d5e40bdddbb6f431254/modules/status/handler.php#L14C81-L14C81
$masterhost = preg_replace('@(.*?:.*)@', "[$1]", setting('MasterServerIP'));
Within MythTV, the function GetMasterServerIP
wthin MythTV now retuns the evaluation of
https://github.com/MythTV/mythtv/blob/c909c36018eec4dc570b9a5d67592850c76c40ac/mythtv/libs/libmythbase/mythcorecontext.cpp#L962
which shows that MasterServerIP
is not a static setting setting anymore.
I found multiple usages of ´MasterServerIP` within mythweb, please eveluate every occurrence.
In modules/tv/classes/Channel.php there is a check for theme_num_time_slots but not theme_timeslot_size.
When a user navigates to /tv/schedules the very first time the results aren't ordered. I believe that it would be good for them to be ordered by title on first.
Suggested fix in pull request #48.
Exists in master, fixes/31, fixes/30 and maybe others.
There is a typo on js/table_sort.js.
this.callback_presort(table_id, heder_index);
should be
this.callback_presort(table_id, header_index);
I haven't spent time working out what this does, and whether the fix breaks something. But it's clearly a mistake.
Easy fix created in pull request #49.
The PHP docs report:
As of PHP 8.1.0, the default setting is MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. Previously, it was MYSQLI_REPORT_OFF.
This is breaking MythWeb from starting if you don't use mythmusic as the init check now throws this:
PHP Fatal error: Uncaught mysqli_sql_exception: Table 'mythconverg.music_songs' doesn't exist in
/usr/share/mythweb/classes/Database/Query/mysqlicompat.php:68
Stack trace:
#0 /usr/share/mythweb/classes/Database/Query/mysqlicompat.php(68): mysqli_query()
#1 /usr/share/mythweb/classes/Database.php(263): Database_Query_mysqlicompat->execute()
#2 /usr/share/mythweb/classes/Database.php(326): Database->query()
#3 /usr/share/mythweb/modules/music/init.php(15): Database->query_col()
#4 /usr/share/mythweb/classes/Modules.php(30): require_once('...')
#5 /usr/share/mythweb/classes/Modules.php(50): Modules::load()
#6 /usr/share/mythweb/mythweb.php(30): Modules::getModule()
Initially I was thinking you could switch to looking up if the table existed in the information_schema which would solve these checks in the init modules however it wouldn't solve this case where the user's custom SQL needs to be attempted and the result reported back.
Options:
mysqli_report(MYSQLI_REPORT_OFF);
somewhere high up (eg. on connect)try...catch
around the mysqli_query call and handle based on the $db->fatal_errors
settingHappy to help with a pull request once an option is decided on,
I've discovered a small bug in MythWeb fixes/31 that is also present in master and older branches.
Resolved in pull request #47.
If I perform the following navigation on MythWeb:
The results returned are no longer filtered by the canned search (Movies, 3½ Stars or more) and if a lot of programs are available in the results it could blow up with: Fatal error: Allowed memory size of <num> bytes exhausted
.
The reason for the issue is that the canned search in the sort link is not encoded correctly. The application then fails to recognise the canned search in search.php and discards it; if (empty($Canned_Searches[$search_name]))
...
The page tv/searches
has the following link:
<a href="tv/search/canned%3AMovies%2C%203%26frac12%3B%20Stars%20or%20more">
The page tv/search/canned%3AMovies%2C 3%26frac12%3B Stars
or more has the following link:
<a href="tv/search/canned:Movies, 3½ Stars or more?sortby=title">
it should be:
<a href="tv/search/canned%3AMovies%2C%203%26frac12%3B%20Stars%20or%20more?sortby=title">
The root cause is the use of PATH_INFO
when building the link in includes/sorting.php
. PATH_INFO
has been previously decoded and is not reencoded on output. An alternative way would be to use REQUEST_URI
as that has not been decoded.
Of course it's well known that MythWeb doesn't support PHP 8.x. In response to this I've seen comments suggesting that pull requests would be considered. I've worked through all of the issues I've identified and created pull request #62. MythWeb is now working for me on 8.0 and I believe it will also work on 8.1. Please consider my pull request.
I see a lot of:
Argument "" isn't numeric in numeric lt (<) at /usr/share/mythtv/mythweb/modules/stream/stream_raw.pl line 123
in my logs when Firefox doesn't use the optional end range in the range header (so the range is just 12345-
). A small addition to check for ''
before the numeric will fix this. Will create a PR now and link to this issue.
Cheers.
Mythweb, Settings, Channel Info. Selecting commfree on some channels and going to end of page and pressing save.
Reproduce everytime.
comfree setting should stay enabled after pressing save.
Screen refreshes and shows the page but with an error message.
"Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini. in Unknown on line 0"
"The fix is insert php_value max_input_vars 10000 in /etc/apache2/sites-available/mythweb.conf in the section with the other php config settings."
This is from https://forum.mythtv.org/viewtopic.php?f=6&t=3788&p=18206&hilit=max_input_vars#p18206 by JeffDwork.
Probably nobody uses these, hence why they have been wrong for so long, but while I'm making minor fixes...
img/
=> img/apple-touch-icons/
If I search for a program, find it, look at the detail and set it to record, the following error is thrown:
error type: Warning
error string: !!NoTrans: Use of undefined constant Math - assumed 'Math' (this will throw an Error in a future version of PHP)!!
filename: modules/tv/classes/Schedule.php
error line: 295
It's been raised by a user in MythTV/mythtv#508 that there is an issue in how MythWeb is handling the tmpl constant. There are no steps to reproduce, but an improvement is clear.
Solved in #78
If I access tv/schedules when using the lite template it shows the recording templates.
These have been excluded from the default template, so the same should apply here.
If I access tv/detail?recordid=... when using the lite template mythweb displays an error.
error type: Warning
error string: !!NoTrans: Attempt to modify property 'recgroup' of non-object!!
filename: .../modules/tv/classes/Schedule.php
error line: 631
This is because the called to recgroup_select incorrectly reference recgroup.
In a follow up to #40 and #71, here is a code fragment that is mysql/mariadb complaint (test on all known/current supported mysql/mariadb versions without requiring sql_mode overrides).
Given that mythweb has a very short future lifetime, it is not clear if this a worthwhile patch, but it is now available if needed....
As I am about to delete my mythweb fork, and that means a PR would get auto deleted, this is inline.
diff --git a/modules/tv/classes/Program.php b/modules/tv/classes/Program.php
index d84a3d9f..a5d4ca77 100644
--- a/modules/tv/classes/Program.php
+++ b/modules/tv/classes/Program.php
@@ -556,9 +556,10 @@ class Program extends MythBase {
public function has_credits() {
global $db;
return $db->query_col('SELECT COUNT(people.name)
- FROM credits, people
- WHERE credits.person = people.person
- AND credits.chanid = ?
+ FROM credits
+ LEFT JOIN people
+ ON credits.person = people.person
+ WHERE credits.chanid = ?
AND credits.starttime = FROM_UNIXTIME(?)',
$this->chanid,
$this->starttime
@@ -573,13 +574,17 @@ class Program extends MythBase {
// No cached value -- load it
if (!isset($this->credits[$role][$add_search_links])) {
// Get the credits for the requested role
- $result = $db->query('SELECT DISTINCT people.name
- FROM credits, people
- WHERE credits.person = people.person
- AND credits.role = ?
- AND credits.chanid = ?
- AND credits.starttime = FROM_UNIXTIME(?)
- ORDER BY credits.priority',
+ $result = $db->query('SELECT p.name
+ FROM (
+ SELECT DISTINCT people.name, credits.priority
+ FROM credits
+ LEFT JOIN people
+ ON credits.person = people.person
+ WHERE credits.role = ?
+ AND credits.chanid = ?
+ AND credits.starttime = FROM_UNIXTIME(?)
+ ORDER BY credits.priority
+ ) p',
$role,
$this->chanid,
$this->starttime
When I visit tv/schedules with either the default or lite template, I cannot sort using the table header.
I want to report Security issue found in MythTV. But did not get any private contract address. please add SECURITY.md file or Ping me : [email protected].
In js/table_sort.js the text "fromt he" should be "from the".
Seems the use of some deprecated functions is breaking Mythweb from working in PHP8.0
errors.php - line 50 - assert_options(ASSERT_QUIET_EVAL, 1); [Deprecated Function
cleanup.php - line 50 - if (get_magic_quotes_gpc()) { [Deprecated Function]
Thats as far as i've gone. I may try and fix on my own and post changes back over the holidays. not sure if someone else is already undertaking this effort. Obviously PHP 7.4 is supported for a long time yet so thats the best workaround for this issue.
Not sure exactly what is wrong and I've almost certainly "fixed" it badly....but.
After doing the release upgrade I was getting this when attempting to access mythweb on the mother in laws PC.
PHP Fatal error: Uncaught Error: Undefined constant "modules_path" in
/usr/share/mythtv/mythweb/includes/class_autoload.php:19\nStack trace:\n#0
/usr/share/mythtv/mythweb/classes/Translate.php(16): autoload()\n#1
/usr/share/mythtv/mythweb/includes/class_autoload.php(18): include_once('...')\n#2 [internal function]: autoload()\n#3 /usr/share/mythtv/mythweb/includes/errors.php(116): class_exists()\n#4 [internal function]: error_handler()\n#5
/usr/share/mythtv/mythweb/includes/php_version_check.php(20): trigger_error()\n#6
/usr/share/mythtv/mythweb/includes/init.php(33): require_once('...')\n#7
/usr/share/mythtv/mythweb/mythweb.php(20): require_once('...')\n#8 {main}\n thrown in
/usr/share/mythtv/mythweb/includes/class_autoload.php on line 19
It looks like it's running the class_autoload before it has run the defines that well define modules_path.
My "fix" for it was to edit /usr/share/mythtv/mythweb/includes/init.php
At the start of the file is
// Attempt to load up firephp if installed on the server
@include_once('FirePHPCore/fb.php');
require_once 'includes/errors.php';
// Lazy load the classes...
require_once 'includes/class_autoload.php';
I changed this to
// Attempt to load up firephp if installed on the server
@include_once('FirePHPCore/fb.php');
require_once 'includes/errors.php';
//these should be loaded before running the class autoloader, it may be better placing these requires there as it is the bit that requires it but other things here will probably also need it
require_once 'includes/utils.php';
require_once 'includes/defines.php';
// Lazy load the classes...
require_once 'includes/class_autoload.php';
and it seems to work.
I'm putting this here rather than a pull in hopes google finds it and hence others do too if they need it. Also I'm at my mother in laws place over xmas and getting all that chooching would be a giant pain. Sorry to whomever picks this one up.
https://code.mythtv.org/trac/ticket/13638
Attached is the first round of patches I first referenced on the forums. The intention is to clear up all of the PHP notices/warnings to make compatibility changes for future PHP versions easier to find. Right now, mythweb runs with an error_reporting() level that hides some potential flaws, along with things that may change from notices/deprecation warnings to errors in future PHP versions. I've only done patches for the default theme to give people an idea of what these changes entail. Obviously with this many changes, maintaining backwards compatibility with the supported -fixes branches can be a bit tricky, so I wanted to gauge expectations on these changes.
I've also attached a few patches for the PHP bindings under the mythtv branch itself.
A notice about the "odd" looking patch in modules/music/mp3act_functions.php where I removed the $db->escape() wrapper. That method automatically adds quotes to the result, which means that when $pl['playlist_songs'] has more than one ID in its comma separated list, it becomes something like "... IN ('1234,4567')", which is wrong. Since I don't see an escape() function that doesn't add the single quotes and the column should only contain numbers or commas, we simply strip anything else to avoid SQL injection.
Changes are coming in browsers relating to cookies that either do not specify SameSite
or set SameSite=None
on cookies.
Firefox can now show:
Cookie “mythweb_id” will be soon rejected because it has the “SameSite” attribute set to “None” or an invalid value, without the “secure” attribute. To know more about the “SameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite
in the console.
For further information, you can also refer to:
https://hacks.mozilla.org/2020/08/changes-to-samesite-cookie-behavior/
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite#fixing_common_warnings
One option is to specify the Secure
attribute with the cookie when SameSite=None
, the others are to specify either SameSite=Lax
or SameSite=Strict
. The former will only work for HTTPS connections, while the latter two will work for both HTTP and HTTPS connections. Given that I believe there is no requirement for a setting of either None
or Lax
, it seems easiest to implement Strict
, which should allow folks to use either HTTP
or HTTPS
on their servers without problems and without additional code to determine which is in use (as would apply if SameSite=None
and the Secure
attribute were used).
I will submit a PR for this.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.