2023-05-08 Fred Gleason <fredg@paravelsystems.com>

* Added a 'FEEDS.SHA1_HASH' field to the database.
	* Incremented the database version to 368.
	* Added 'RDFeed::sha1Hash()' and 'RDFeed::setSha1Hash()' methods.
	* Added a 'RDSha1HashData()' function.
	* Optimized the podcasting subsystem so as to upload feed XML only
	when the XML contents have actually changed.

Signed-off-by: Fred Gleason <fredg@paravelsystems.com>
This commit is contained in:
Fred Gleason
2023-05-08 13:23:01 -04:00
parent 1e73e29028
commit afd6a67cd5
15 changed files with 201 additions and 106 deletions

View File

@@ -62,12 +62,27 @@ MainObject::MainObject(QObject *parent)
exit(256);
}
if(!filename.isEmpty()) { // Hash the specified file
hash=RDSha1HashFile(filename);
if(hash.isEmpty()) {
fprintf(stderr,"test_hash: unable to open \"%s\"\n",
filename.toUtf8().constData());
exit(256);
if(!filename.isEmpty()) {
if(filename=="-") { // Read from stdin
char data[1024];
ssize_t n;
QByteArray bytes;
while((n=read(0,data,1024))>0) {
bytes+=QByteArray(data,n);
}
if(n<0) {
fprintf(stderr,"test_hash: %s\n",strerror(errno));
exit(256);
}
hash=RDSha1HashData(bytes);
}
else { // Hash the specified file
hash=RDSha1HashFile(filename);
if(hash.isEmpty()) {
fprintf(stderr,"test_hash: unable to open \"%s\"\n",
filename.toUtf8().constData());
exit(256);
}
}
printf("%s\n",hash.toUtf8().constData());
exit(0);

View File

@@ -24,7 +24,7 @@
#include <rdcmd_switch.cpp>
#include <rdhash.h>
#define TEST_HASH_USAGE "[options]\n\nTest SHA1 hash generation\n\n--filename=<file-name>\n The name of the file for which to generate a hash.\n\n--password=<secret>\n Generate a password hash from <secret>\n\n--hash=<hash>\n When given with --secret, verify <hash>\n\n"
#define TEST_HASH_USAGE "[options]\n\nTest SHA1 hash generation\n\n--filename=<file-name>\n The name of the file for which to generate a hash. A <filename> of '-'\n will cause the data to be hashed to be read from standard input.\n\n--password=<secret>\n Generate a password hash from <secret>\n\n--hash=<hash>\n When given with --secret, verify <hash>\n\n"
class MainObject : public QObject
{