diff --git a/pkgs/applications/networking/instant-messengers/element/element-web.nix b/pkgs/applications/networking/instant-messengers/element/element-web.nix deleted file mode 100644 index 1bfea7162dde..000000000000 --- a/pkgs/applications/networking/instant-messengers/element/element-web.nix +++ /dev/null @@ -1,85 +0,0 @@ -{ lib -, stdenv -, fetchFromGitHub -, fetchYarnDeps -, jq -, yarn -, fixup-yarn-lock -, nodejs -, jitsi-meet -}: - -let - pinData = import ./pin.nix; - inherit (pinData.hashes) webSrcHash webYarnHash; - noPhoningHome = { - disable_guests = true; # disable automatic guest account registration at matrix.org - }; -in -stdenv.mkDerivation (finalAttrs: builtins.removeAttrs pinData [ "hashes" ] // { - pname = "element-web"; - - src = fetchFromGitHub { - owner = "element-hq"; - repo = "element-web"; - rev = "v${finalAttrs.version}"; - hash = webSrcHash; - }; - - offlineCache = fetchYarnDeps { - yarnLock = finalAttrs.src + "/yarn.lock"; - sha256 = webYarnHash; - }; - - nativeBuildInputs = [ yarn fixup-yarn-lock jq nodejs ]; - - buildPhase = '' - runHook preBuild - - export VERSION=${finalAttrs.version} - yarn --offline build:res - yarn --offline build:module_system - yarn --offline build:bundle - - runHook postBuild - ''; - - configurePhase = '' - runHook preConfigure - - export HOME=$PWD/tmp - # with the update of openssl3, some key ciphers are not supported anymore - # this flag will allow those codecs again as a workaround - # see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07 - # and https://github.com/element-hq/element-web/issues/21043 - export NODE_OPTIONS=--openssl-legacy-provider - mkdir -p $HOME - - fixup-yarn-lock yarn.lock - yarn config --offline set yarn-offline-mirror $offlineCache - yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive - patchShebangs node_modules - - runHook postConfigure - ''; - - installPhase = '' - runHook preInstall - - cp -R webapp $out - tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js - echo "${finalAttrs.version}" > "$out/version" - jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json" - - runHook postInstall - ''; - - meta = { - description = "Glossy Matrix collaboration client for the web"; - homepage = "https://element.io/"; - changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md"; - maintainers = lib.teams.matrix.members; - license = lib.licenses.asl20; - platforms = lib.platforms.all; - }; -}) diff --git a/pkgs/applications/networking/instant-messengers/element/pin.nix b/pkgs/applications/networking/instant-messengers/element/pin.nix deleted file mode 100644 index 2f12882e5ef0..000000000000 --- a/pkgs/applications/networking/instant-messengers/element/pin.nix +++ /dev/null @@ -1,9 +0,0 @@ -{ - "version" = "1.11.87"; - "hashes" = { - "desktopSrcHash" = "sha256-rIxuXMHQVJrbfWibpiIBmTkXKHrBqnTMiBYIP8VOIH4="; - "desktopYarnHash" = "05qs1an3mbqsfn1nmgwagp564lqvyrbkyj58z5h2cbczqbavnxxz"; - "webSrcHash" = "sha256-FcXYwYCx//fqWuUKRqTTntlT7jVBD1Heayg4T7ACHmc="; - "webYarnHash" = "0anamnfm5g4nj7wp18byi49x38aia490qfard2d34myzjgiby8v3"; - }; -} diff --git a/pkgs/applications/office/softmaker/generic.nix b/pkgs/applications/office/softmaker/generic.nix index a3fee9a114de..b92a994bd701 100644 --- a/pkgs/applications/office/softmaker/generic.nix +++ b/pkgs/applications/office/softmaker/generic.nix @@ -46,7 +46,7 @@ in stdenv.mkDerivation { inherit pname src; - version = "${edition}.${version}"; + version = if edition != "" then "${edition}.${version}" else version; nativeBuildInputs = [ autoPatchelfHook diff --git a/pkgs/applications/office/softmaker/softmaker-office-nx.nix b/pkgs/applications/office/softmaker/softmaker-office-nx.nix new file mode 100644 index 000000000000..f6b152df6883 --- /dev/null +++ b/pkgs/applications/office/softmaker/softmaker-office-nx.nix @@ -0,0 +1,32 @@ +{ + callPackage, + fetchurl, + + # This is a bit unusual, but makes version and hash easily + # overridable. This is useful when the upstream archive was replaced + # and nixpkgs is not in sync yet. + officeVersion ? { + version = "1222"; + edition = ""; + hash = "sha256-8ya9RYpd9G5SITYOpvhxjQE8ieV8TuAApkjNwCf9nHs="; + }, + + ... +}@args: + +callPackage ./generic.nix ( + args + // rec { + inherit (officeVersion) version edition; + + pname = "softmaker-office-nx"; + suiteName = "SoftMaker Office NX"; + + src = fetchurl { + inherit (officeVersion) hash; + url = "https://www.softmaker.net/down/softmaker-office-nx-${version}-amd64.tgz"; + }; + + archive = "officenx.tar.lzma"; + } +) diff --git a/pkgs/applications/office/softmaker/softmaker_office.nix b/pkgs/applications/office/softmaker/softmaker-office.nix similarity index 100% rename from pkgs/applications/office/softmaker/softmaker_office.nix rename to pkgs/applications/office/softmaker/softmaker-office.nix diff --git a/pkgs/by-name/el/element-desktop/element-desktop-pin.nix b/pkgs/by-name/el/element-desktop/element-desktop-pin.nix new file mode 100644 index 000000000000..ed64279ccb16 --- /dev/null +++ b/pkgs/by-name/el/element-desktop/element-desktop-pin.nix @@ -0,0 +1,7 @@ +{ + "version" = "1.11.89"; + "hashes" = { + "desktopSrcHash" = "sha256-vZLM1AIMxDltB+GeQEcYifnaBC1+4wWkotPFuelHxT0="; + "desktopYarnHash" = "1n057ic4dzcyg3wfr8jj7vab00jg2d1m38y5zk1kab1pka163f1q"; + }; +} diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix b/pkgs/by-name/el/element-desktop/keytar/default.nix similarity index 89% rename from pkgs/applications/networking/instant-messengers/element/keytar/default.nix rename to pkgs/by-name/el/element-desktop/keytar/default.nix index 993bbcd2068f..4b9411b8f75f 100644 --- a/pkgs/applications/networking/instant-messengers/element/keytar/default.nix +++ b/pkgs/by-name/el/element-desktop/keytar/default.nix @@ -8,8 +8,6 @@ pkg-config, libsecret, xcbuild, - Security, - AppKit, fetchNpmDeps, npmHooks, }: @@ -36,12 +34,7 @@ stdenv.mkDerivation rec { npmHooks.npmConfigHook ] ++ lib.optional stdenv.hostPlatform.isDarwin xcbuild; - buildInputs = - lib.optionals (!stdenv.hostPlatform.isDarwin) [ libsecret ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ - Security - AppKit - ]; + buildInputs = lib.optionals (!stdenv.hostPlatform.isDarwin) [ libsecret ]; npmDeps = fetchNpmDeps { inherit src; diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/pin.json b/pkgs/by-name/el/element-desktop/keytar/pin.json similarity index 100% rename from pkgs/applications/networking/instant-messengers/element/keytar/pin.json rename to pkgs/by-name/el/element-desktop/keytar/pin.json diff --git a/pkgs/applications/networking/instant-messengers/element/keytar/update.sh b/pkgs/by-name/el/element-desktop/keytar/update.sh similarity index 100% rename from pkgs/applications/networking/instant-messengers/element/keytar/update.sh rename to pkgs/by-name/el/element-desktop/keytar/update.sh diff --git a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix b/pkgs/by-name/el/element-desktop/package.nix similarity index 96% rename from pkgs/applications/networking/instant-messengers/element/element-desktop.nix rename to pkgs/by-name/el/element-desktop/package.nix index 3bccfdec1d68..f0f92cccb0df 100644 --- a/pkgs/applications/networking/instant-messengers/element/element-desktop.nix +++ b/pkgs/by-name/el/element-desktop/package.nix @@ -13,9 +13,6 @@ element-web, sqlcipher, callPackage, - Security, - AppKit, - CoreServices, desktopToDarwinBundle, useKeytar ? true, # command line arguments which are always set @@ -23,11 +20,11 @@ }: let - pinData = import ./pin.nix; + pinData = import ./element-desktop-pin.nix; inherit (pinData.hashes) desktopSrcHash desktopYarnHash; executableName = "element-desktop"; - keytar = callPackage ./keytar { inherit Security AppKit; }; - seshat = callPackage ./seshat { inherit CoreServices; }; + keytar = callPackage ./keytar { }; + seshat = callPackage ./seshat { }; electron = electron_33; in stdenv.mkDerivation ( @@ -146,6 +143,7 @@ stdenv.mkDerivation ( ''; passthru = { + # run with: nix-shell ./maintainers/scripts/update.nix --argstr package element-desktop updateScript = ./update.sh; # TL;DR: keytar is optional while seshat isn't. diff --git a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix b/pkgs/by-name/el/element-desktop/seshat/default.nix similarity index 93% rename from pkgs/applications/networking/instant-messengers/element/seshat/default.nix rename to pkgs/by-name/el/element-desktop/seshat/default.nix index 800650ce5b66..5e3bb3f0aa07 100644 --- a/pkgs/applications/networking/instant-messengers/element/seshat/default.nix +++ b/pkgs/by-name/el/element-desktop/seshat/default.nix @@ -3,13 +3,11 @@ stdenv, rustPlatform, fetchFromGitHub, - rust, sqlcipher, nodejs, python3, yarn, fixup-yarn-lock, - CoreServices, fetchYarnDeps, removeReferencesTo, }: @@ -37,7 +35,7 @@ rustPlatform.buildRustPackage rec { yarn fixup-yarn-lock ]; - buildInputs = [ sqlcipher ] ++ lib.optional stdenv.hostPlatform.isDarwin CoreServices; + buildInputs = [ sqlcipher ]; npm_config_nodedir = nodejs; diff --git a/pkgs/applications/networking/instant-messengers/element/seshat/pin.json b/pkgs/by-name/el/element-desktop/seshat/pin.json similarity index 100% rename from pkgs/applications/networking/instant-messengers/element/seshat/pin.json rename to pkgs/by-name/el/element-desktop/seshat/pin.json diff --git a/pkgs/applications/networking/instant-messengers/element/seshat/update.sh b/pkgs/by-name/el/element-desktop/seshat/update.sh similarity index 100% rename from pkgs/applications/networking/instant-messengers/element/seshat/update.sh rename to pkgs/by-name/el/element-desktop/seshat/update.sh diff --git a/pkgs/applications/networking/instant-messengers/element/update.sh b/pkgs/by-name/el/element-desktop/update.sh similarity index 83% rename from pkgs/applications/networking/instant-messengers/element/update.sh rename to pkgs/by-name/el/element-desktop/update.sh index 2a4ec5fcdec2..20251b2644a4 100755 --- a/pkgs/applications/networking/instant-messengers/element/update.sh +++ b/pkgs/by-name/el/element-desktop/update.sh @@ -1,5 +1,5 @@ #!/usr/bin/env nix-shell -#!nix-shell -I nixpkgs=../../../../../ -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq +#!nix-shell -i bash -p nix wget prefetch-yarn-deps nix-prefetch-github jq if [ "$#" -gt 1 ] || [[ "$1" == -* ]]; then echo "Regenerates packaging data for the element packages." @@ -22,6 +22,8 @@ version="${version#v}" web_src="https://raw.githubusercontent.com/element-hq/element-web/v$version" web_src_hash=$(nix-prefetch-github element-hq element-web --rev v${version} | jq -r .hash) +cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1 + web_tmpdir=$(mktemp -d) trap 'rm -rf "$web_tmpdir"' EXIT @@ -42,14 +44,22 @@ wget -q "$desktop_src/yarn.lock" desktop_yarn_hash=$(prefetch-yarn-deps yarn.lock) popd -cat > pin.nix << EOF +cat > ../element-web-unwrapped/element-web-pin.nix << EOF { "version" = "$version"; "hashes" = { - "desktopSrcHash" = "$desktop_src_hash"; - "desktopYarnHash" = "$desktop_yarn_hash"; "webSrcHash" = "$web_src_hash"; "webYarnHash" = "$web_yarn_hash"; }; } EOF + +cat > element-desktop-pin.nix << EOF +{ + "version" = "$version"; + "hashes" = { + "desktopSrcHash" = "$desktop_src_hash"; + "desktopYarnHash" = "$desktop_yarn_hash"; + }; +} +EOF diff --git a/pkgs/by-name/el/element-web-unwrapped/element-web-pin.nix b/pkgs/by-name/el/element-web-unwrapped/element-web-pin.nix new file mode 100644 index 000000000000..6bd45a77319d --- /dev/null +++ b/pkgs/by-name/el/element-web-unwrapped/element-web-pin.nix @@ -0,0 +1,7 @@ +{ + "version" = "1.11.89"; + "hashes" = { + "webSrcHash" = "sha256-K9i5MxTJaX359qsnpfXZBZiNHbhCEy25plUPVUtbGQs="; + "webYarnHash" = "164smvrq9937x0pql20zdqab5w35fcidbywkzlyc5g4w7iwkd9kx"; + }; +} diff --git a/pkgs/by-name/el/element-web-unwrapped/package.nix b/pkgs/by-name/el/element-web-unwrapped/package.nix new file mode 100644 index 000000000000..b03d2a2c79a8 --- /dev/null +++ b/pkgs/by-name/el/element-web-unwrapped/package.nix @@ -0,0 +1,95 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchYarnDeps, + jq, + yarn, + fixup-yarn-lock, + nodejs, + jitsi-meet, +}: + +let + pinData = import ./element-web-pin.nix; + inherit (pinData.hashes) webSrcHash webYarnHash; + noPhoningHome = { + disable_guests = true; # disable automatic guest account registration at matrix.org + }; +in +stdenv.mkDerivation ( + finalAttrs: + builtins.removeAttrs pinData [ "hashes" ] + // { + pname = "element-web"; + + src = fetchFromGitHub { + owner = "element-hq"; + repo = "element-web"; + rev = "v${finalAttrs.version}"; + hash = webSrcHash; + }; + + offlineCache = fetchYarnDeps { + yarnLock = finalAttrs.src + "/yarn.lock"; + sha256 = webYarnHash; + }; + + nativeBuildInputs = [ + yarn + fixup-yarn-lock + jq + nodejs + ]; + + buildPhase = '' + runHook preBuild + + export VERSION=${finalAttrs.version} + yarn --offline build:res + yarn --offline build:module_system + yarn --offline build:bundle + + runHook postBuild + ''; + + configurePhase = '' + runHook preConfigure + + export HOME=$PWD/tmp + # with the update of openssl3, some key ciphers are not supported anymore + # this flag will allow those codecs again as a workaround + # see https://medium.com/the-node-js-collection/node-js-17-is-here-8dba1e14e382#5f07 + # and https://github.com/element-hq/element-web/issues/21043 + export NODE_OPTIONS=--openssl-legacy-provider + mkdir -p $HOME + + fixup-yarn-lock yarn.lock + yarn config --offline set yarn-offline-mirror $offlineCache + yarn install --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive + patchShebangs node_modules + + runHook postConfigure + ''; + + installPhase = '' + runHook preInstall + + cp -R webapp $out + tar --extract --to-stdout --file ${jitsi-meet.src} jitsi-meet/libs/external_api.min.js > $out/jitsi_external_api.min.js + echo "${finalAttrs.version}" > "$out/version" + jq -s '.[0] * $conf' "config.sample.json" --argjson "conf" '${builtins.toJSON noPhoningHome}' > "$out/config.json" + + runHook postInstall + ''; + + meta = { + description = "Glossy Matrix collaboration client for the web"; + homepage = "https://element.io/"; + changelog = "https://github.com/element-hq/element-web/blob/v${finalAttrs.version}/CHANGELOG.md"; + maintainers = lib.teams.matrix.members; + license = lib.licenses.asl20; + platforms = lib.platforms.all; + }; + } +) diff --git a/pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix b/pkgs/by-name/el/element-web/package.nix similarity index 100% rename from pkgs/applications/networking/instant-messengers/element/element-web-wrapper.nix rename to pkgs/by-name/el/element-web/package.nix diff --git a/pkgs/by-name/gh/gh/package.nix b/pkgs/by-name/gh/gh/package.nix index f99e8f777d3f..e744dbb923f1 100644 --- a/pkgs/by-name/gh/gh/package.nix +++ b/pkgs/by-name/gh/gh/package.nix @@ -10,16 +10,16 @@ buildGoModule rec { pname = "gh"; - version = "2.63.2"; + version = "2.64.0"; src = fetchFromGitHub { owner = "cli"; repo = "cli"; rev = "refs/tags/v${version}"; - hash = "sha256-MxgwnRTIJFpYhZZhyc59ZAzgi6ud7mHpdSIImMlkwtg="; + hash = "sha256-5OdUA0rwBUjfoUZfXzFBmt/GFuvH3pm8JV2iLhaJQek="; }; - vendorHash = "sha256-UCEtvEpfoyJs5lpoAfMehg5cFQ3XlESRT8XFIwvyYas="; + vendorHash = "sha256-lMhSJSQHCY/bDeFM2L2Dfo4ApkjTkg8R0PwOpGr+Gi0="; nativeBuildInputs = [ installShellFiles ]; diff --git a/pkgs/by-name/me/meteor-git/package.nix b/pkgs/by-name/me/meteor-git/package.nix index 5146e0759cfe..94371fa8b855 100644 --- a/pkgs/by-name/me/meteor-git/package.nix +++ b/pkgs/by-name/me/meteor-git/package.nix @@ -6,13 +6,13 @@ buildGoModule rec { pname = "meteor-git"; - version = "0.24.2"; + version = "0.25.0"; src = fetchFromGitHub { owner = "stefanlogue"; repo = "meteor"; rev = "v${version}"; - hash = "sha256-VuP7W20Mtml6K41PxQ8fPBeXLNvnvlMT8+rL5RIYi+A="; + hash = "sha256-2VeCbxHQNV2gNsRs7JVdSRmKI1pYZzW+amybrSRcjGY="; }; vendorHash = "sha256-jKd/eJwp5SZvTrP3RN7xT7ibAB0PQondGR3RT+HQXIo="; diff --git a/pkgs/by-name/mi/mieru/package.nix b/pkgs/by-name/mi/mieru/package.nix index 8f23dbfabb25..ce770989c8e6 100644 --- a/pkgs/by-name/mi/mieru/package.nix +++ b/pkgs/by-name/mi/mieru/package.nix @@ -6,16 +6,16 @@ buildGoModule rec { pname = "mieru"; - version = "3.7.0"; + version = "3.9.0"; src = fetchFromGitHub { owner = "enfein"; repo = "mieru"; rev = "v${version}"; - hash = "sha256-VFQWiihwd0YiLpgTxKUjVd+IkGivsa4jI/jb5ckjFt8="; + hash = "sha256-59TWABRIH3FEOyLvZ+jn7b3jhI0comjU4Mrl4Ggx2eA="; }; - vendorHash = "sha256-woQoqYjdv2TZo66IwNkSHzIHFlu9JH8q/RXGyLlnTTc="; + vendorHash = "sha256-hSTKhn39xKZx1N9x66EH/ql4oP4qn0eysGTbUk9mRAk="; proxyVendor = true; ldflags = [ diff --git a/pkgs/by-name/mj/mjolnir/001-disable-nsfwprotection.patch b/pkgs/by-name/mj/mjolnir/001-disable-nsfwprotection.patch index ceeaa90f6351..2566f65b1d1b 100644 --- a/pkgs/by-name/mj/mjolnir/001-disable-nsfwprotection.patch +++ b/pkgs/by-name/mj/mjolnir/001-disable-nsfwprotection.patch @@ -1,9 +1,9 @@ diff --git a/src/protections/NsfwProtection.ts b/src/protections/NsfwProtection.ts deleted file mode 100644 -index 8b6f8fd..0000000 +index a6f45b2..0000000 --- a/src/protections/NsfwProtection.ts +++ /dev/null -@@ -1,99 +0,0 @@ +@@ -1,115 +0,0 @@ -/* -Copyright 2024 The Matrix.org Foundation C.I.C. - @@ -22,10 +22,9 @@ index 8b6f8fd..0000000 - -import { Protection } from "./IProtection"; -import { Mjolnir } from "../Mjolnir"; --import * as nsfw from 'nsfwjs'; --import {LogLevel} from "@vector-im/matrix-bot-sdk"; --import { node } from '@tensorflow/tfjs-node'; -- +-import * as nsfw from "nsfwjs"; +-import { LogLevel, LogService } from "@vector-im/matrix-bot-sdk"; +-import { node } from "@tensorflow/tfjs-node"; - -export class NsfwProtection extends Protection { - settings = {}; @@ -41,37 +40,50 @@ index 8b6f8fd..0000000 - } - - public get name(): string { -- return 'NsfwProtection'; +- return "NsfwProtection"; - } - - public get description(): string { -- return "Scans all images sent into a protected room to determine if the image is " + -- "NSFW. If it is, the image will automatically be redacted."; +- return ( +- "Scans all images sent into a protected room to determine if the image is " + +- "NSFW. If it is, the image will automatically be redacted." +- ); - } - - public async handleEvent(mjolnir: Mjolnir, roomId: string, event: any): Promise { -- if (event['type'] === 'm.room.message') { -- let content = JSON.stringify(event['content']); +- if (event["type"] === "m.room.message") { +- let content = JSON.stringify(event["content"]); - if (!content.toLowerCase().includes("mxc")) { - return; -- } +- } - // try and grab a human-readable alias for more helpful management room output -- const maybeAlias = await mjolnir.client.getPublishedAlias(roomId) -- const room = maybeAlias ? maybeAlias : roomId +- const maybeAlias = await mjolnir.client.getPublishedAlias(roomId); +- const room = maybeAlias ? maybeAlias : roomId; - - const mxcs = content.match(/(mxc?:\/\/[^\s'"]+)/gim); - if (!mxcs) { - //something's gone wrong with the regex -- await mjolnir.managementRoomOutput.logMessage(LogLevel.ERROR, "NSFWProtection", `Unable to find any mxcs in ${event["event_id"]} in ${room}`); +- await mjolnir.managementRoomOutput.logMessage( +- LogLevel.ERROR, +- "NSFWProtection", +- `Unable to find any mxcs in ${event["event_id"]} in ${room}`, +- ); - return; - } - - // @ts-ignore - see null check immediately above - for (const mxc of mxcs) { - const image = await mjolnir.client.downloadContent(mxc); -- const decodedImage = await node.decodeImage(image.data, 3); -- const predictions = await this.model.classify(decodedImage); - +- let decodedImage; +- try { +- decodedImage = await node.decodeImage(image.data, 3); +- } catch (e) { +- LogService.error("NsfwProtection", `There was an error processing an image: ${e}`); +- continue; +- } +- +- const predictions = await this.model.classify(decodedImage); - - for (const prediction of predictions) { - if (["Hentai", "Porn"].includes(prediction["className"])) { @@ -79,22 +91,26 @@ index 8b6f8fd..0000000 - try { - await mjolnir.client.redactEvent(roomId, event["event_id"]); - } catch (err) { -- await mjolnir.managementRoomOutput.logMessage(LogLevel.ERROR, "NSFWProtection", `There was an error redacting ${event["event_id"]} in ${room}: ${err}`); +- await mjolnir.managementRoomOutput.logMessage( +- LogLevel.ERROR, +- "NSFWProtection", +- `There was an error redacting ${event["event_id"]} in ${room}: ${err}`, +- ); - } -- let eventId = event["event_id"] -- let body = `Redacted an image in ${room} ${eventId}` +- let eventId = event["event_id"]; +- let body = `Redacted an image in ${room} ${eventId}`; - let formatted_body = `
- Redacted an image in ${room} --
${eventId}
${room}
--                                                  
` +-
${eventId}
${room}
+- `; - const msg = { - msgtype: "m.notice", - body: body, - format: "org.matrix.custom.html", -- formatted_body: formatted_body +- formatted_body: formatted_body, - }; - await mjolnir.client.sendMessage(mjolnir.managementRoomId, msg); -- break +- break; - } - } - } @@ -103,16 +119,15 @@ index 8b6f8fd..0000000 - } - } -} -\ No newline at end of file diff --git a/src/protections/ProtectionManager.ts b/src/protections/ProtectionManager.ts -index 9b84318..67f10dc 100644 +index 485f05e..6ffb0d1 100644 --- a/src/protections/ProtectionManager.ts +++ b/src/protections/ProtectionManager.ts @@ -31,7 +31,6 @@ import { htmlEscape } from "../utils"; import { ERROR_KIND_FATAL, ERROR_KIND_PERMISSION } from "../ErrorCache"; import { RoomUpdateError } from "../models/RoomUpdateError"; import { LocalAbuseReports } from "./LocalAbuseReports"; --import {NsfwProtection} from "./NsfwProtection"; +-import { NsfwProtection } from "./NsfwProtection"; import { MentionSpam } from "./MentionSpam"; const PROTECTIONS: Protection[] = [ @@ -121,10 +136,10 @@ index 9b84318..67f10dc 100644 new JoinWaveShortCircuit(), new LocalAbuseReports(), - new NsfwProtection(), - new MentionSpam() + new MentionSpam(), ]; -@@ -104,9 +102,6 @@ export class ProtectionManager { +@@ -106,9 +104,6 @@ export class ProtectionManager { protection.settings[key].setValue(value); } if (protection.enabled) { @@ -136,49 +151,54 @@ index 9b84318..67f10dc 100644 } diff --git a/test/integration/nsfwProtectionTest.ts b/test/integration/nsfwProtectionTest.ts deleted file mode 100644 -index c86fd38..0000000 +index ed215e0..0000000 --- a/test/integration/nsfwProtectionTest.ts +++ /dev/null -@@ -1,78 +0,0 @@ --import {newTestUser} from "./clientHelper"; +@@ -1,89 +0,0 @@ +-import { newTestUser } from "./clientHelper"; - --import {MatrixClient} from "@vector-im/matrix-bot-sdk"; --import {getFirstReaction} from "./commands/commandUtils"; --import {strict as assert} from "assert"; --import { readFileSync } from 'fs'; +-import { MatrixClient } from "@vector-im/matrix-bot-sdk"; +-import { getFirstReaction } from "./commands/commandUtils"; +-import { strict as assert } from "assert"; +-import { readFileSync } from "fs"; - -describe("Test: NSFW protection", function () { - let client: MatrixClient; - let room: string; - this.beforeEach(async function () { -- client = await newTestUser(this.config.homeserverUrl, {name: {contains: "nsfw-protection"}}); +- client = await newTestUser(this.config.homeserverUrl, { name: { contains: "nsfw-protection" } }); - await client.start(); - const mjolnirId = await this.mjolnir.client.getUserId(); - room = await client.createRoom({ invite: [mjolnirId] }); - await client.joinRoom(room); - await client.joinRoom(this.config.managementRoom); - await client.setUserPowerLevel(mjolnirId, room, 100); -- }) +- }); - this.afterEach(async function () { - await client.stop(); -- }) +- }); - - function delay(ms: number) { -- return new Promise(resolve => setTimeout(resolve, ms)); +- return new Promise((resolve) => setTimeout(resolve, ms)); - } - -- -- it("Nsfw protection doesn't redact sfw images", async function() { +- it("Nsfw protection doesn't redact sfw images", async function () { - this.timeout(20000); - -- await client.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir rooms add ${room}` }); -- await getFirstReaction(client, this.mjolnir.managementRoomId, '✅', async () => { -- return await client.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir enable NsfwProtection` }); +- await client.sendMessage(this.mjolnir.managementRoomId, { +- msgtype: "m.text", +- body: `!mjolnir rooms add ${room}`, +- }); +- await getFirstReaction(client, this.mjolnir.managementRoomId, "✅", async () => { +- return await client.sendMessage(this.mjolnir.managementRoomId, { +- msgtype: "m.text", +- body: `!mjolnir enable NsfwProtection`, +- }); - }); - -- const data = readFileSync('test_tree.jpg'); -- const mxc = await client.uploadContent(data, 'image/png'); -- let content = {"msgtype": "m.image", "body": "test.jpeg", "url": mxc}; +- const data = readFileSync("test_tree.jpg"); +- const mxc = await client.uploadContent(data, "image/png"); +- let content = { msgtype: "m.image", body: "test.jpeg", url: mxc }; - let imageMessage = await client.sendMessage(room, content); - - await delay(500); @@ -186,36 +206,41 @@ index c86fd38..0000000 - assert.equal(Object.keys(processedImage.content).length, 3, "This event should not have been redacted"); - }); - -- it("Nsfw protection redacts nsfw images", async function() { +- it("Nsfw protection redacts nsfw images", async function () { - this.timeout(20000); - // dial the sensitivity on the protection way up so that all images are flagged as NSFW - this.mjolnir.config.nsfwSensitivity = 0.0; - -- await client.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir rooms add ${room}` }); -- await getFirstReaction(client, this.mjolnir.managementRoomId, '✅', async () => { -- return await client.sendMessage(this.mjolnir.managementRoomId, { msgtype: 'm.text', body: `!mjolnir enable NsfwProtection` }); +- await client.sendMessage(this.mjolnir.managementRoomId, { +- msgtype: "m.text", +- body: `!mjolnir rooms add ${room}`, +- }); +- await getFirstReaction(client, this.mjolnir.managementRoomId, "✅", async () => { +- return await client.sendMessage(this.mjolnir.managementRoomId, { +- msgtype: "m.text", +- body: `!mjolnir enable NsfwProtection`, +- }); - }); - -- const data = readFileSync('test_tree.jpg'); -- const mxc = await client.uploadContent(data, 'image/png'); -- let content = {"msgtype": "m.image", "body": "test.jpeg", "url": mxc}; +- const data = readFileSync("test_tree.jpg"); +- const mxc = await client.uploadContent(data, "image/png"); +- let content = { msgtype: "m.image", body: "test.jpeg", url: mxc }; - let imageMessage = await client.sendMessage(room, content); - -- let formatted_body = `` +- let formatted_body = ``; - let htmlContent = { -- msgtype: "m.image", -- body: formatted_body, -- format: "org.matrix.custom.html", -- formatted_body: formatted_body -- }; -- let htmlMessage = await client.sendMessage(room, htmlContent) +- msgtype: "m.image", +- body: formatted_body, +- format: "org.matrix.custom.html", +- formatted_body: formatted_body, +- }; +- let htmlMessage = await client.sendMessage(room, htmlContent); - - await delay(500); - let processedImage = await client.getEvent(room, imageMessage); - assert.equal(Object.keys(processedImage.content).length, 0, "This event should have been redacted"); - -- let processedHtml = await client.getEvent(room, htmlMessage) -- assert.equal(Object.keys(processedHtml.content).length, 0, "This html image event should have been redacted") +- let processedHtml = await client.getEvent(room, htmlMessage); +- assert.equal(Object.keys(processedHtml.content).length, 0, "This html image event should have been redacted"); - }); -}); -\ No newline at end of file diff --git a/pkgs/by-name/mj/mjolnir/package.json b/pkgs/by-name/mj/mjolnir/package.json index fa276e8569a2..d0ffe772a827 100644 --- a/pkgs/by-name/mj/mjolnir/package.json +++ b/pkgs/by-name/mj/mjolnir/package.json @@ -1,6 +1,6 @@ { "name": "mjolnir", - "version": "1.8.3", + "version": "1.9.1", "description": "A moderation tool for Matrix", "main": "lib/index.js", "repository": "git@github.com:matrix-org/mjolnir.git", @@ -10,7 +10,7 @@ "scripts": { "build": "tsc", "postbuild": "rm -rf lib/test/ && cp -r lib/src/* lib/ && rm -rf lib/src/", - "lint": "tslint --project ./tsconfig.json -t stylish", + "lint": "tslint --project ./tsconfig.json -t stylish && npx prettier . --check", "start:dev": "yarn build && node --async-stack-traces lib/index.js", "test": "ts-mocha --project ./tsconfig.json test/commands/**/*.ts", "test:integration": "NODE_ENV=harness ts-mocha --async-stack-traces --require test/integration/fixtures.ts --timeout 300000 --project ./tsconfig.json \"test/integration/**/*Test.ts\"", @@ -58,6 +58,7 @@ "humanize-duration-ts": "^2.1.1", "js-yaml": "^4.1.0", "jsdom": "^16.6.0", + "lru-cache": "^11.0.1", "matrix-appservice-bridge": "10.3.1", "nsfwjs": "^4.1.0", "parse-duration": "^1.0.2", @@ -69,5 +70,6 @@ }, "engines": { "node": ">=20.0.0" - } + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" } diff --git a/pkgs/by-name/mj/mjolnir/package.nix b/pkgs/by-name/mj/mjolnir/package.nix index 098ed9bf9b3a..215675d0f5cb 100644 --- a/pkgs/by-name/mj/mjolnir/package.nix +++ b/pkgs/by-name/mj/mjolnir/package.nix @@ -11,13 +11,13 @@ mkYarnPackage rec { pname = "mjolnir"; - version = "1.8.3"; + version = "1.9.1"; src = fetchFromGitHub { owner = "matrix-org"; repo = "mjolnir"; rev = "refs/tags/v${version}"; - hash = "sha256-yD7QGsS2Em8Z95po9pGRUDmHgHe4z0j0Jnvy3IG7xKY="; + hash = "sha256-LK2CgMLDJHfr1+ejHYeJNw2ekCnUA8GHufZ6vbifzGQ="; }; patches = [ @@ -29,7 +29,7 @@ mkYarnPackage rec { offlineCache = fetchYarnDeps { yarnLock = src + "/yarn.lock"; - hash = "sha256-05DqddK8+136Qq/JGeiITZkVJ8Dw9K9HfACKW86989U="; + hash = "sha256-1V7ooONt9j+4hk/3w6Dsv/SdWwa1xsLk97EwhuPegNo="; }; packageResolutions = { diff --git a/pkgs/by-name/ya/yazi-unwrapped/package.nix b/pkgs/by-name/ya/yazi-unwrapped/package.nix index 4e88fbf2f240..a092cbb76017 100644 --- a/pkgs/by-name/ya/yazi-unwrapped/package.nix +++ b/pkgs/by-name/ya/yazi-unwrapped/package.nix @@ -11,20 +11,20 @@ rustPlatform.buildRustPackage rec { pname = "yazi"; - version = "0.4.1"; + version = "0.4.2"; src = fetchFromGitHub { owner = "sxyazi"; repo = "yazi"; rev = "v${version}"; - hash = "sha256-YKP+9EfLiXbVivKWWL+arx+2Ek+XydS2VjGy3DncD8s="; + hash = "sha256-2fBajVFpmgNHb90NbK59yUeaYLWR7rhQxpce9Tq1uQU="; }; - cargoHash = "sha256-vH2ihp/X6W1OQfYwMT2vpn8c1PKaX9Uf1Tp2HvQl+o8="; + cargoHash = "sha256-54KD20C1oFK2KlH6aCwvjT4tf4p15FJV5y6pJUoQXG0="; env.YAZI_GEN_COMPLETIONS = true; env.VERGEN_GIT_SHA = "Nixpkgs"; - env.VERGEN_BUILD_DATE = "2024-12-11"; + env.VERGEN_BUILD_DATE = "2024-12-20"; nativeBuildInputs = [ installShellFiles ]; buildInputs = [ rust-jemalloc-sys ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Foundation ]; diff --git a/pkgs/servers/irc/solanum/default.nix b/pkgs/servers/irc/solanum/default.nix index da41c55c7e7e..ed21b5ab0991 100644 --- a/pkgs/servers/irc/solanum/default.nix +++ b/pkgs/servers/irc/solanum/default.nix @@ -10,18 +10,19 @@ pkg-config, sqlite, util-linux, + unstableGitUpdater, nixosTests, }: stdenv.mkDerivation rec { pname = "solanum"; - version = "unstable-2022-07-12"; + version = "0-unstable-2024-07-24"; src = fetchFromGitHub { owner = "solanum-ircd"; - repo = pname; - rev = "860187d02895fc953de3475da07a7a06b9380254"; - hash = "sha256-g8hXmxTfcPDmQ/cu4AI/iJfrhPLaQJEAeMdDhNDsVXs="; + repo = "solanum"; + rev = "4e89f6603d63b2f8dfdec7a83161fb0343236349"; + hash = "sha256-kUgB0Q+U6jx8Xyh1DSv8D7+Q9tC2wK3aaNt4At5chFQ="; }; patches = [ @@ -68,7 +69,10 @@ stdenv.mkDerivation rec { # make[4]: *** [Makefile:634: solanum] Error 1 enableParallelInstalling = false; - passthru.tests = { inherit (nixosTests) solanum; }; + passthru = { + tests = { inherit (nixosTests) solanum; }; + updateScript = unstableGitUpdater { }; + }; meta = with lib; { description = "IRCd for unified networks"; diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index a1980526fc29..542a353472d1 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -328,7 +328,7 @@ mapAliases { edUnstable = throw "edUnstable was removed; use ed instead"; # Added 2024-07-01 elasticsearch7Plugins = elasticsearchPlugins; - # Electron + element-desktop-wayland = throw "element-desktop-wayland has been removed. Consider setting NIXOS_OZONE_WL=1 via 'environment.sessionVariables' instead"; # Added 2024-12-17 elixir_ls = elixir-ls; # Added 2023-03-20 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index be70248c6aec..4ce4e6ec8790 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2279,17 +2279,7 @@ with pkgs; electronplayer = callPackage ../applications/video/electronplayer/electronplayer.nix { }; - element-desktop = callPackage ../applications/networking/instant-messengers/element/element-desktop.nix { - inherit (darwin.apple_sdk.frameworks) Security AppKit CoreServices; - }; - element-desktop-wayland = writeScriptBin "element-desktop" '' - #!/bin/sh - NIXOS_OZONE_WL=1 exec ${element-desktop}/bin/element-desktop "$@" - ''; - - element-web-unwrapped = callPackage ../applications/networking/instant-messengers/element/element-web.nix { }; - - element-web = callPackage ../applications/networking/instant-messengers/element/element-web-wrapper.nix { + element-web = callPackage ../by-name/el/element-web/package.nix { conf = config.element-web.conf or { }; }; @@ -13898,7 +13888,12 @@ with pkgs; jre = jre8; # TODO: remove override https://github.com/NixOS/nixpkgs/pull/89731 }; - freeoffice = callPackage ../applications/office/softmaker/freeoffice.nix { }; + inherit + ({ + freeoffice = callPackage ../applications/office/softmaker/freeoffice.nix { }; + }) + freeoffice + ; inherit (xorg) xlsfonts; @@ -14911,7 +14906,15 @@ with pkgs; smtube = libsForQt5.callPackage ../applications/video/smtube { }; - softmaker-office = callPackage ../applications/office/softmaker/softmaker_office.nix { }; + inherit + ({ + softmaker-office = callPackage ../applications/office/softmaker/softmaker-office.nix { }; + softmaker-office-nx = callPackage ../applications/office/softmaker/softmaker-office-nx.nix { }; + }) + softmaker-office + softmaker-office-nx + ; + synapse-bt = callPackage ../applications/networking/p2p/synapse-bt { inherit (darwin.apple_sdk.frameworks) CoreServices Security;