-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Roadmap: More Enhancements in Development #9
Comments
--help output as of
Notes:
|
Configuration Files Use INI file format. Each value is optional. Comments can be used "; " etc. Complex strings need to be quoted. (See the useragent entry below).
|
Notes on the blocklist concept: This is already done in get-fav with the google API and the default icon. This simply allows a list of md5 hashes of other icons for the program to ignore. |
If a json structure is used, it is defined as follows with
Supported Fields are (so far):
Sample:
|
Debug Log File Information
The "shipping" default is 31 which is all bug debug and trace. The timestamp, by default uses The default log separator used if it is appending to an existing log file is 80
Switches: Files:
Console:
Configuration Options:
Notes:
|
Proposed Web Variables
|
Status:
June 23rd 2023
Haven't been able to do much work this week due to some unexpected household emergencies, should be back at it next week.
202306161401
--showhttpwarnings
--showhttperrors
. (With the options enabled, they will output asTYPE_WARNING
andTYPE_ERROR
.)TYPE_OBJECTS
,TYPE_TIMERS
(full debug logging is now1023
)202306121848
:curl, exif, get, put, mbstring, fileinfo, mimetype, gd, imagemagick, gmagick, hrtime
. If an extension is listed as true in this section but is not loaded or available, it will change to false. (Please note, GD, ImageMagick and gmagick are not currently used at all.)--sites
as an alternate to--list
Some notes on this:
Having our own image identification is important should the PHP installation be limited (for whatever reason) and going by file extension is still the last resort.
The method used for this is looking for the "signature" of the image file. Most image formats have a header with signature data to be used by software trying to open it (this is also called a "magic number".) The new code knows PNG, GIF, JPEG, WEBP, BMP and ICO formats.
Some image formats are easier to identify than others, for example PNG format's "magic" which is
\x89PNG\r\n\x1A\n
which is pretty good. BMP and ICO have very very simple identifiers and so having false positives is much more likely which is why I've been adding a "certainty" rating. Eventually you'll be able to set a minimum acceptable "certainty" and reject possibly invalid files. (You can currently set it but nothing looks at it.)Here's some sample trace logging showing this in action:
2023-06-12 18:47:21 [TRACE] [grap_favicon(20):listIcons:getMIMETypeFromFile] pathname='icons/whatsapp.png', content_type=image/png, confidence=certain, method=signature
Ideally, if everything is available to get-fav.php the following methods are used, in order:
FileInfo
mime_content_type
(local files only)exif_imagetype
(andimage_type_to_mime_type
if available)getMIMETypeFromBinary
(the new fallback function using "magic")202306071311
:--checklocal
/--nochecklocal
,--storeifnew
(requires --checklocal and --store) ( Not implemented yet. )--showconfig
/--noshowconfig
to show running configuration options--showconfigonly
(implies--showconfig
), shows running configuration and exits.--silent
(console mode only) (turns off the console completely)ENABLE_SAME_FOLDER_INI
andENABLE_SAME_FOLDER_API_INI
. They default tofalse
. If they are set totrue
, ifget-fav.ini
andget-fav-api.ini
, respectively, are in the same folder asget-fav.php
they will be read and used automatically.--configfile
and--apiconfigfile
, if specified, will be applied after.It will likely be a few days before I do another
git push
as the next one is a big one:storeifnew
is enabled it will be replaced)202306062230
:file_get_contents
is not available, check if PHP.INI:allow_url_fopen
is disabled, if so show an error message.202306042323
:--apiconfigfile=PATHNAME
to load API Definitions202306021445
:202306011529
:--allowoctetstream
/--disallowoctetstream
, the default isfalse
because if the more accurate content-type detection is not available most will returnapplication/octet-stream
. I may make the default true if andmime_content_type
and/orfinfo_open
are available. (.ini file is[global] allow_octet_stream=boolean
)202305312016
:202305281757
:202305251719
:202305242106
:get-fav-api.ini
)202305241803
:202305241420
:202305221634
:parse_ini_file
withINI_SCANNER_RAW
, doesarray_replace_recursive
with the existing configuration structure and finally validates boolean/numeric (with range checks).)202305231619
:Stuff being worked on:
(I'm keeping my github fork up to date as I work on stuff, assuming it's not throwing horrible errors.)
--checkicon--checklocal
option will check the icon in the local path first and check online only if missing or otherwise invalid (size, type, blocklist). (in progress)configuration.md
for detailed help on options.defines
for easier maintenance.--disableapis=google,faviconkit
)microsoft.com.ico
becomesmicrosoft.ico
)--version
(akav
andver
)define
$debug
to a bool--user-agent
is passed in.writeOutput
)Issues:
--help
output takes more than one standard console screen (| more
or| clip
need to be used)Before pull request:
Other Tasks:
Notes:
define
block at the top,The text was updated successfully, but these errors were encountered: