Random avatars: png instead of svg.

This commit is contained in:
John Livingston 2022-01-06 05:57:09 +01:00
parent c0a7f94936
commit f966a69249
No known key found for this signature in database
GPG Key ID: B17B5640CE66CDBC
3 changed files with 810 additions and 3 deletions

806
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@
"eslint-plugin-standard": "^5.0.0",
"npm-run-all": "^4.1.5",
"sass": "^1.43.4",
"sharp-cli": "^1.15.0",
"stylelint": "^14.0.1",
"stylelint-config-recommended-scss": "^5.0.1",
"stylelint-config-standard-scss": "^2.0.1",
@ -84,7 +85,7 @@
"prepare": "npm run clean && npm run build",
"build:converse": "bash conversejs/build-conversejs.sh",
"build:images": "mkdir -p dist/client/images && npx svgo -f public/images/ -o dist/client/images/",
"build:avatars": "mkdir -p dist/server/avatars && npx svgo -f public/images/avatars/ -o dist/server/avatars/",
"build:avatars": "mkdir -p dist/server/avatars && ./node_modules/sharp-cli/bin/cli.js -i ./public/images/avatars/**/*.svg -o ./dist/server/avatars/ -f png resize 40 40",
"build:webpack": "webpack --mode=production",
"build:server": "npx tsc --build server/tsconfig.json",
"build:serverconverse": "mkdir -p dist/server/conversejs && cp conversejs/index.html dist/server/conversejs/",

View File

@ -10,7 +10,7 @@ local avatars = {};
local function load_avatar(filename)
local file = assert(io.open(path.join(avatars_dir, filename), "r"));
local result = {
type = 'image/svg+xml',
type = 'image/png',
content = b64(file:read("*a"))
};
file:close();
@ -18,7 +18,7 @@ local function load_avatar(filename)
end
local AVATARS_COUNT = 10;
for i = 1, AVATARS_COUNT do
avatars[i] = load_avatar(i .. '.svg');
avatars[i] = load_avatar(i .. '.png');
end
module:hook("iq-get/bare/vcard-temp:vCard", function (event)