filter out unsupported images [CI SKIP]
All checks were successful
continuous-integration/drone/tag Build is passing
All checks were successful
continuous-integration/drone/tag Build is passing
This commit is contained in:
76
src/main.cpp
76
src/main.cpp
@@ -292,6 +292,8 @@ static bool ApplyImmichPayload(ImmichConfig &config, const QString &payload)
|
||||
if (obj.contains("albumId") && obj["albumId"].isString())
|
||||
{
|
||||
config.albumIds = { obj["albumId"].toString().toStdString() };
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("albumIds") && obj["albumIds"].isArray())
|
||||
@@ -303,11 +305,15 @@ static bool ApplyImmichPayload(ImmichConfig &config, const QString &payload)
|
||||
if (value.isString())
|
||||
config.albumIds.push_back(value.toString().toStdString());
|
||||
}
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("personId") && obj["personId"].isString())
|
||||
{
|
||||
config.personIds = { obj["personId"].toString().toStdString() };
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("personIds") && obj["personIds"].isArray())
|
||||
@@ -319,6 +325,24 @@ static bool ApplyImmichPayload(ImmichConfig &config, const QString &payload)
|
||||
if (value.isString())
|
||||
config.personIds.push_back(value.toString().toStdString());
|
||||
}
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("userId") && obj["userId"].isString())
|
||||
{
|
||||
config.userId = obj["userId"].toString().toStdString();
|
||||
config.albumIds.clear();
|
||||
config.personIds.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("ownerId") && obj["ownerId"].isString())
|
||||
{
|
||||
config.userId = obj["ownerId"].toString().toStdString();
|
||||
config.albumIds.clear();
|
||||
config.personIds.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("order") && obj["order"].isString())
|
||||
@@ -364,6 +388,30 @@ static bool ApplyImmichPayload(ImmichConfig &config, const QString &payload)
|
||||
{
|
||||
config.albumIds.clear();
|
||||
config.personIds.clear();
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("extensions") && obj["extensions"].isArray())
|
||||
{
|
||||
config.allowedExtensions.clear();
|
||||
QJsonArray arr = obj["extensions"].toArray();
|
||||
for (const auto &value : arr)
|
||||
{
|
||||
if (value.isString())
|
||||
config.allowedExtensions.push_back(value.toString().toLower().toStdString());
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
if (obj.contains("allowedExtensions") && obj["allowedExtensions"].isArray())
|
||||
{
|
||||
config.allowedExtensions.clear();
|
||||
QJsonArray arr = obj["allowedExtensions"].toArray();
|
||||
for (const auto &value : arr)
|
||||
{
|
||||
if (value.isString())
|
||||
config.allowedExtensions.push_back(value.toString().toLower().toStdString());
|
||||
}
|
||||
changed = true;
|
||||
}
|
||||
return changed;
|
||||
@@ -391,26 +439,54 @@ static bool ApplyImmichPayload(ImmichConfig &config, const QString &payload)
|
||||
{
|
||||
config.albumIds.clear();
|
||||
config.personIds.clear();
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "album" || key == "albumid")
|
||||
{
|
||||
config.albumIds = { value.toStdString() };
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "albums" || key == "albumids")
|
||||
{
|
||||
config.albumIds = SplitCsv(value);
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "person" || key == "personid")
|
||||
{
|
||||
config.personIds = { value.toStdString() };
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "persons" || key == "personids")
|
||||
{
|
||||
config.personIds = SplitCsv(value);
|
||||
config.userId.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "user" || key == "userid" || key == "ownerid")
|
||||
{
|
||||
config.userId = value.toStdString();
|
||||
config.albumIds.clear();
|
||||
config.personIds.clear();
|
||||
config.allowedExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
if (key == "extensions" || key == "allowedextensions")
|
||||
{
|
||||
config.allowedExtensions = SplitCsv(value);
|
||||
for (auto &ext : config.allowedExtensions)
|
||||
{
|
||||
for (auto &c : ext)
|
||||
c = static_cast<char>(::tolower(c));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (key == "order")
|
||||
|
||||
Reference in New Issue
Block a user