diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index eb9677be..4020deea 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -47,6 +47,7 @@ jobs: .spago output - run: psql -f src/Server/sql/index.sql postgresql://merochat_test:merochat_test@localhost:5432/merochat_test + - run: mkdir -p file/upload - run: npm install - run: spago build - run: spago test \ No newline at end of file diff --git a/.gitignore b/.gitignore index 4285c9f8..8b7fd8af 100755 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ bower_components -node_modules +node_modules/ .pulp-cache -output +output/ generated-docs .psc-package .psc* @@ -9,16 +9,10 @@ generated-docs .psa* .pulp_cache .vscode -src/Client/media/upload/ -configuration.json -old/ -fix output-es/ -distcopy/ todo -dce-output/ .cache/ .spago/ -dist/ -parcel*.log +file/bundle/ +file/upload spago.log \ No newline at end of file diff --git a/build-production.sh b/build-production.sh index 9e97247c..c8bb465f 100644 --- a/build-production.sh +++ b/build-production.sh @@ -1,14 +1,10 @@ #!/bin/bash -dist_folder="dist/production" -bundle_folder="bundle" -bucket="ourmelon" - npm install && -rm -rf dist/production && +rm -rf file/bundle && rm -rf output-es && spago -x production.dhall build && npx webpack --progress --config webpack.production.config.js && npx webpack --progress --config webpack.landing.config.js && -b2-linux sync --keepDays 7 --replaceNewer "$PWD/$dist_folder" "b2://$bucket/$bundle_folder" && pm2 restart server --update-env + diff --git a/src/Client/media/avatar-1.png b/file/default/avatar-1.png similarity index 100% rename from src/Client/media/avatar-1.png rename to file/default/avatar-1.png diff --git a/src/Client/media/avatar-2.png b/file/default/avatar-2.png similarity index 100% rename from src/Client/media/avatar-2.png rename to file/default/avatar-2.png diff --git a/src/Client/media/avatar-3.png b/file/default/avatar-3.png similarity index 100% rename from src/Client/media/avatar-3.png rename to file/default/avatar-3.png diff --git a/src/Client/media/avatar-4.png b/file/default/avatar-4.png similarity index 100% rename from src/Client/media/avatar-4.png rename to file/default/avatar-4.png diff --git a/src/Client/media/avatar-5.png b/file/default/avatar-5.png similarity index 100% rename from src/Client/media/avatar-5.png rename to file/default/avatar-5.png diff --git a/src/Client/media/avatar-6.png b/file/default/avatar-6.png similarity index 100% rename from src/Client/media/avatar-6.png rename to file/default/avatar-6.png diff --git a/src/Client/media/avatar-7.png b/file/default/avatar-7.png similarity index 100% rename from src/Client/media/avatar-7.png rename to file/default/avatar-7.png diff --git a/src/Client/media/avatar-8.png b/file/default/avatar-8.png similarity index 100% rename from src/Client/media/avatar-8.png rename to file/default/avatar-8.png diff --git a/src/Client/media/batman_noun_project_Anusha_Narvekar.png b/file/default/batman_noun_project_Anusha_Narvekar.png similarity index 100% rename from src/Client/media/batman_noun_project_Anusha_Narvekar.png rename to file/default/batman_noun_project_Anusha_Narvekar.png diff --git a/src/Client/media/favicon-1.ico b/file/default/favicon-1.ico similarity index 100% rename from src/Client/media/favicon-1.ico rename to file/default/favicon-1.ico diff --git a/src/Client/media/favicon-10-plus.ico b/file/default/favicon-10-plus.ico similarity index 100% rename from src/Client/media/favicon-10-plus.ico rename to file/default/favicon-10-plus.ico diff --git a/src/Client/media/favicon-10.ico b/file/default/favicon-10.ico similarity index 100% rename from src/Client/media/favicon-10.ico rename to file/default/favicon-10.ico diff --git a/src/Client/media/favicon-2.ico b/file/default/favicon-2.ico similarity index 100% rename from src/Client/media/favicon-2.ico rename to file/default/favicon-2.ico diff --git a/src/Client/media/favicon-3.ico b/file/default/favicon-3.ico similarity index 100% rename from src/Client/media/favicon-3.ico rename to file/default/favicon-3.ico diff --git a/src/Client/media/favicon-4.ico b/file/default/favicon-4.ico similarity index 100% rename from src/Client/media/favicon-4.ico rename to file/default/favicon-4.ico diff --git a/src/Client/media/favicon-5.ico b/file/default/favicon-5.ico similarity index 100% rename from src/Client/media/favicon-5.ico rename to file/default/favicon-5.ico diff --git a/src/Client/media/favicon-6.ico b/file/default/favicon-6.ico similarity index 100% rename from src/Client/media/favicon-6.ico rename to file/default/favicon-6.ico diff --git a/src/Client/media/favicon-7.ico b/file/default/favicon-7.ico similarity index 100% rename from src/Client/media/favicon-7.ico rename to file/default/favicon-7.ico diff --git a/src/Client/media/favicon-8.ico b/file/default/favicon-8.ico similarity index 100% rename from src/Client/media/favicon-8.ico rename to file/default/favicon-8.ico diff --git a/src/Client/media/favicon-9.ico b/file/default/favicon-9.ico similarity index 100% rename from src/Client/media/favicon-9.ico rename to file/default/favicon-9.ico diff --git a/src/Client/media/favicon.ico b/file/default/favicon.ico similarity index 100% rename from src/Client/media/favicon.ico rename to file/default/favicon.ico diff --git a/src/Client/media/landing-medium.png b/file/default/landing-medium.png similarity index 100% rename from src/Client/media/landing-medium.png rename to file/default/landing-medium.png diff --git a/src/Client/media/loading.png b/file/default/loading.png similarity index 100% rename from src/Client/media/loading.png rename to file/default/loading.png diff --git a/src/Client/media/logo-3-small.png b/file/default/logo-3-small.png similarity index 100% rename from src/Client/media/logo-3-small.png rename to file/default/logo-3-small.png diff --git a/src/Client/media/logo-small.png b/file/default/logo-small.png similarity index 100% rename from src/Client/media/logo-small.png rename to file/default/logo-small.png diff --git a/src/Client/media/logo.png b/file/default/logo.png similarity index 100% rename from src/Client/media/logo.png rename to file/default/logo.png diff --git a/src/Client/media/nicolas_cage_hiclipart.png b/file/default/nicolas_cage_hiclipart.png similarity index 100% rename from src/Client/media/nicolas_cage_hiclipart.png rename to file/default/nicolas_cage_hiclipart.png diff --git a/src/Client/media/point1.png b/file/default/point1.png similarity index 100% rename from src/Client/media/point1.png rename to file/default/point1.png diff --git a/src/Client/media/point2.png b/file/default/point2.png similarity index 100% rename from src/Client/media/point2.png rename to file/default/point2.png diff --git a/src/Client/media/point3.png b/file/default/point3.png similarity index 100% rename from src/Client/media/point3.png rename to file/default/point3.png diff --git a/src/Client/media/point4.png b/file/default/point4.png similarity index 100% rename from src/Client/media/point4.png rename to file/default/point4.png diff --git a/src/Client/media/point5.png b/file/default/point5.png similarity index 100% rename from src/Client/media/point5.png rename to file/default/point5.png diff --git a/src/Client/media/point6.png b/file/default/point6.png similarity index 100% rename from src/Client/media/point6.png rename to file/default/point6.png diff --git a/src/Client/media/point7.png b/file/default/point7.png similarity index 100% rename from src/Client/media/point7.png rename to file/default/point7.png diff --git a/src/Client/media/socrates_Sting_wikimedia.png b/file/default/socrates_Sting_wikimedia.png similarity index 100% rename from src/Client/media/socrates_Sting_wikimedia.png rename to file/default/socrates_Sting_wikimedia.png diff --git a/src/Client/media/suggestions.png b/file/default/suggestions.png similarity index 100% rename from src/Client/media/suggestions.png rename to file/default/suggestions.png diff --git a/src/Client/media/works1.png b/file/default/works1.png similarity index 100% rename from src/Client/media/works1.png rename to file/default/works1.png diff --git a/src/Client/media/works2.png b/file/default/works2.png similarity index 100% rename from src/Client/media/works2.png rename to file/default/works2.png diff --git a/src/Client/media/works3.png b/file/default/works3.png similarity index 100% rename from src/Client/media/works3.png rename to file/default/works3.png diff --git a/package-lock.json b/package-lock.json index fd6b067e..82c17243 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "0.5.0", "license": "AGPL-3.0-or-later", "dependencies": { - "b2-js": "^1.2.4", "big-integer": "^1.6.48", "html-inline-css-webpack-plugin": "^1.11.1", "html-webpack-plugin": "^5.5.0", @@ -474,20 +473,6 @@ "resolved": "https://registry.npmjs.org/assignment/-/assignment-2.0.0.tgz", "integrity": "sha1-/9F7Ib9dayLnd7mJaBqBVFaj3T4=" }, - "node_modules/b2-js": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/b2-js/-/b2-js-1.2.4.tgz", - "integrity": "sha512-b6biGNB95X8ffXhTf67ZxYGNcw++BPjcRXpq8BDq1PzLbrHSKJgSCUQ+1ZaQ20AzHCQ8kQy2rKhVjhgDXiOflg==", - "dependencies": { - "node-fetch": "^2.6.0", - "tslib": "^2.0.0" - } - }, - "node_modules/b2-js/node_modules/tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" - }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -2078,25 +2063,6 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, "node_modules/node-gyp-build": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", @@ -2114,9 +2080,9 @@ "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==" }, "node_modules/nodemailer": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.3.tgz", - "integrity": "sha512-faZFufgTMrphYoDjvyVpbpJcYzwyFnbAMmQtj1lVBYAUSm3SOy2fIdd9+Mr4UxPosBa0JRw9bJoIwQn+nswiew==", + "version": "6.9.14", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.14.tgz", + "integrity": "sha512-Dobp/ebDKBvz91sbtRKhcznLThrKxKt97GI2FAlAyy+fk19j73Uz3sBXolVtmcXjaorivqsbbbjDY+Jkt4/bQA==", "engines": { "node": ">=6.0.0" } @@ -2150,9 +2116,9 @@ } }, "node_modules/nodemon/node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true, "bin": { "semver": "bin/semver" @@ -3356,13 +3322,10 @@ } }, "node_modules/semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, "bin": { "semver": "bin/semver.js" }, @@ -3370,18 +3333,6 @@ "node": ">=10" } }, - "node_modules/semver/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/serialize-javascript": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", @@ -3430,9 +3381,9 @@ "dev": true }, "node_modules/simple-update-notifier": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz", - "integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", "dev": true, "dependencies": { "semver": "~7.0.0" @@ -3738,11 +3689,6 @@ "node": "*" } }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, "node_modules/tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -3821,11 +3767,6 @@ "node": ">=10.13.0" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, "node_modules/webpack": { "version": "5.76.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz", @@ -3961,15 +3902,6 @@ "node": ">=10.13.0" } }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "node_modules/which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -4030,12 +3962,6 @@ "node": ">=0.4" } }, - "node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", @@ -4414,22 +4340,6 @@ "resolved": "https://registry.npmjs.org/assignment/-/assignment-2.0.0.tgz", "integrity": "sha1-/9F7Ib9dayLnd7mJaBqBVFaj3T4=" }, - "b2-js": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/b2-js/-/b2-js-1.2.4.tgz", - "integrity": "sha512-b6biGNB95X8ffXhTf67ZxYGNcw++BPjcRXpq8BDq1PzLbrHSKJgSCUQ+1ZaQ20AzHCQ8kQy2rKhVjhgDXiOflg==", - "requires": { - "node-fetch": "^2.6.0", - "tslib": "^2.0.0" - }, - "dependencies": { - "tslib": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz", - "integrity": "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==" - } - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -5590,14 +5500,6 @@ } } }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, "node-gyp-build": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", @@ -5610,9 +5512,9 @@ "integrity": "sha512-Qe5OUajvqrqDSy6wrWFmMwfJ0jVgwiw4T3KqmbTcZ62qW0gQkheXYhcFM1+lOVcGUoRxcEcfyvFMAnDgaF1VWw==" }, "nodemailer": { - "version": "6.6.3", - "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.6.3.tgz", - "integrity": "sha512-faZFufgTMrphYoDjvyVpbpJcYzwyFnbAMmQtj1lVBYAUSm3SOy2fIdd9+Mr4UxPosBa0JRw9bJoIwQn+nswiew==" + "version": "6.9.14", + "resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.14.tgz", + "integrity": "sha512-Dobp/ebDKBvz91sbtRKhcznLThrKxKt97GI2FAlAyy+fk19j73Uz3sBXolVtmcXjaorivqsbbbjDY+Jkt4/bQA==" }, "nodemon": { "version": "2.0.20", @@ -5633,9 +5535,9 @@ }, "dependencies": { "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", + "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", "dev": true } } @@ -6463,24 +6365,10 @@ } }, "semver": { - "version": "7.3.5", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", - "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", - "dev": true, - "requires": { - "lru-cache": "^6.0.0" - }, - "dependencies": { - "lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "requires": { - "yallist": "^4.0.0" - } - } - } + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true }, "serialize-javascript": { "version": "6.0.0", @@ -6521,9 +6409,9 @@ "dev": true }, "simple-update-notifier": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.0.7.tgz", - "integrity": "sha512-BBKgR84BJQJm6WjWFMHgLVuo61FBDSj1z/xSFUIozqO6wO7ii0JxCqlIud7Enr/+LhlbNI0whErq96P2qHNWew==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/simple-update-notifier/-/simple-update-notifier-1.1.0.tgz", + "integrity": "sha512-VpsrsJSUcJEseSbMHkrsrAVSdvVS5I96Qo1QAQ4FxQ9wXFcB+pjj7FB7/us9+GcgfW4ziHtYMc1J0PLczb55mg==", "dev": true, "requires": { "semver": "~7.0.0" @@ -6734,11 +6622,6 @@ } } }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=" - }, "tslib": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", @@ -6812,11 +6695,6 @@ "graceful-fs": "^4.1.2" } }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=" - }, "webpack": { "version": "5.76.0", "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.0.tgz", @@ -6909,15 +6787,6 @@ "source-map": "~0.6.1" } }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, "which": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", @@ -6955,12 +6824,6 @@ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" }, - "yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, "yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", diff --git a/package.json b/package.json index 63430315..0e21df8f 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,6 @@ "author": "Eduardo Asafe", "license": "AGPL-3.0-or-later", "dependencies": { - "b2-js": "^1.2.4", "big-integer": "^1.6.48", "html-inline-css-webpack-plugin": "^1.11.1", "html-webpack-plugin": "^5.5.0", diff --git a/spago.dhall b/spago.dhall index c45c5292..81f3cb0c 100644 --- a/spago.dhall +++ b/spago.dhall @@ -41,7 +41,6 @@ You can edit this file as you like. , "maybe" , "newtype" , "node-buffer" - , "node-fs" , "node-fs-aff" , "node-http" , "node-process" diff --git a/src/Client/Im/Chat.purs b/src/Client/Im/Chat.purs index 3001fc82..35e1d773 100644 --- a/src/Client/Im/Chat.purs +++ b/src/Client/Im/Chat.purs @@ -44,7 +44,7 @@ import Shared.Element (ElementId(..)) import Shared.Im.Contact as SIC import Shared.Markdown (Token(..)) import Shared.Markdown as SM -import Shared.Options.File (maxImageSize) +import Shared.Resource (maxImageSize) import Shared.Unsafe ((!@)) import Shared.Unsafe as SU import Type.Proxy (Proxy(..)) diff --git a/src/Client/Im/Contacts.purs b/src/Client/Im/Contacts.purs index 55a2970a..ee5ef44e 100644 --- a/src/Client/Im/Contacts.purs +++ b/src/Client/Im/Contacts.purs @@ -193,7 +193,6 @@ displayNewContacts newContacts model = updateDisplayContacts newContacts (map (\ displayImpersonatedContacts ∷ Int → HistoryMessage → Array Contact → ImModel → MoreMessages displayImpersonatedContacts id history newContacts = displayNewContacts (map (_ { shouldFetchChatHistory = false, impersonating = Just id, history = [ history ] }) newContacts) ---todo: way too complicated, just fetch everthing resumeMissedEvents ∷ MissedEvents → ImModel → MoreMessages resumeMissedEvents { contacts: missedContacts, messageIds } model@{ contacts, user: { id: senderID } } = let diff --git a/src/Client/Im/Main.purs b/src/Client/Im/Main.purs index a21573ae..c56b3463 100644 --- a/src/Client/Im/Main.purs +++ b/src/Client/Im/Main.purs @@ -667,23 +667,23 @@ markContactUnavailable contacts userId = updateContact <$> contacts | otherwise = contact checkMissedEvents ∷ ImModel → MoreMessages -checkMissedEvents model@{ experimenting, contacts, user: { id } } = +checkMissedEvents model = model :> - if DM.isJust experimenting then [] + if DM.isJust model.experimenting then [] else [ do - let { lastSentMessageID, lastReceivedMessageID } = findLastMessages contacts id + let { lastSentMessageId, lastReceivedMessageId } = findLastMessages model.contacts model.user.id - if DM.isNothing lastSentMessageID && DM.isNothing lastReceivedMessageID then + if DM.isNothing lastSentMessageId && DM.isNothing lastReceivedMessageId then pure Nothing else - CCNT.retryableResponse CheckMissedEvents ResumeMissedEvents (request.im.missedEvents { query: { lastSenderId: lastSentMessageID, lastRecipientId: lastReceivedMessageID } }) + CCNT.retryableResponse CheckMissedEvents ResumeMissedEvents (request.im.missedEvents { query: { lastSenderId: lastSentMessageId, lastRecipientId: lastReceivedMessageId } }) ] -findLastMessages ∷ Array Contact → Int → { lastSentMessageID ∷ Maybe Int, lastReceivedMessageID ∷ Maybe Int } +findLastMessages ∷ Array Contact → Int → { lastSentMessageId ∷ Maybe Int, lastReceivedMessageId ∷ Maybe Int } findLastMessages contacts sessionUserID = - { lastSentMessageID: findLast (\h → sessionUserID == h.sender && h.status == Received) - , lastReceivedMessageID: findLast ((sessionUserID /= _) <<< _.sender) + { lastSentMessageId: findLast (\h → sessionUserID == h.sender && h.status == Received) + , lastReceivedMessageId: findLast ((sessionUserID /= _) <<< _.sender) } where findLast f = do diff --git a/src/Client/Im/Notification.purs b/src/Client/Im/Notification.purs index 247035a7..1e5b6152 100644 --- a/src/Client/Im/Notification.purs +++ b/src/Client/Im/Notification.purs @@ -1,10 +1,12 @@ module Client.Im.Notification where import Prelude +import Shared.Im.Types import Client.Common.Dom as CCD import Client.Im.Flame (NextMessage) import Data.Array as DA +import Data.Either (Either(..)) import Data.Foldable as DF import Data.HashMap as HS import Data.Maybe (Maybe(..)) @@ -16,13 +18,12 @@ import Effect.Uncurried (EffectFn1) import Effect.Uncurried as EU import Flame ((:>)) import Flame.Subscription as FS +import Shared.Element as SE import Shared.Experiments.Impersonation (impersonations) -import Shared.Im.Types import Shared.Im.Unread as SIU import Shared.Options.MountPoint (imId) import Shared.Resource (Media(..), ResourceType(..)) import Shared.Resource as SP -import Shared.Element as SE import Shared.Unsafe as SU import Web.HTML.HTMLLinkElement as WHL @@ -56,7 +57,7 @@ notify { user: { id: sessionUserId }, contacts, smallScreen } userIds = do Nothing → user Just id → SU.fromJust $ HS.lookup id impersonations ).name - , icon: SP.mediaPath Loading Png + , icon: SP.resourcePath (Left Loading) Png , handler: FS.send imId <<< ResumeChat $ Tuple user.id impersonating --move to given chat when clicking on system notification } diff --git a/src/Client/css/im.css b/src/Client/css/im.css index 817617f3..d9183d84 100644 --- a/src/Client/css/im.css +++ b/src/Client/css/im.css @@ -1333,7 +1333,7 @@ select { } .loading { - background: url('https://static.mero.chat/file/ourmelon/loading.png'); + background: url('https://static.mero.chat/file/default/loading.png'); animation: rotating 2s linear infinite; width: 46px; height: 44px; diff --git a/src/Server/3000/Data.purs b/src/Server/3000/Data.purs index 44f3f720..181a0466 100644 --- a/src/Server/3000/Data.purs +++ b/src/Server/3000/Data.purs @@ -48,7 +48,7 @@ grammaticalClasses = [ Tuple 5 [ "Pines", "Cries", "Knots", "Bombs", "Rolls", "Stuns", "Hands", "Marks", "Roars", "Mixes", "Loses", "Grins", "Lifts", "Nests", "Votes", "Bores", "Harms", "Yawns", "Cures", "Plays", "Stirs", "Bumps", "Gives", "Sells", "Jails", "Knits", "Times", "Folds", "Emits", "Drags", "Doles", "Flows", "Stabs", "Suits", "Combs", "Prays", "Lands", "Types", "Skips", "Parks", "Shuts", "Feeds", "Snows", "Rings", "Loves", "Yells", "Urges", "Jumps", "Gazes", "Boils", "Feels", "Heaps", "Dares", "Makes", "Keeps", "Fools", "Frets", "Shops", "Traps", "Kills", "Mines", "Faces", "Heats", "Dusts", "Bears", "Notes", "Lists", "Hails", "Holds", "Plans", "Tells", "Avows", "Hates", "Joins", "Tames", "Stops", "Gnaws", "Sways", "Gasps", "Pries", "Leans", "Bites", "Dotes", "Rises", "Fades", "Falls", "Hunts", "Bares", "Heals", "Boxes", "Chips", "Trips", "Sings", "Flies", "Rains", "Picks", "Means", "Hopes", "Fixes", "Steps", "Soaks", "Irons", "Sends", "Earns", "Fumes", "Spots", "Jokes", "Lasts", "Thaws", "Jests", "Barks", "Signs", "Hangs", "Rates", "Hints", "Tours", "Glues", "Rants", "Calls", "Rocks", "Omits", "Dumps", "Lives", "Bakes", "Pulls", "Deals", "Buries", "Trims", "Fires", "Moves", "Cooks", "Pours", "Loans", "Risks", "Dives", "Names", "Dials", "Reads", "Draws", "Chops", "Hears", "Tests", "Faxes", "Fries", "Shows", "Opens", "Beats", "Files", "Peers", "Zooms", "Costs", "Brags", "Jolts", "Parts", "Dupes", "Spins", "Leads", "Knows", "Burns", "Books", "Flaps", "Obeys", "Drops", "Likes", "Curls", "Ticks", "Pelts", "Molts", "Meets", "Swims", "Lends", "Stays", "Slips", "Posts", "Tires", "Cares", "Raves", "Sighs", "Finds", "Bawls", "Docks", "Chews", "Saves", "Locks", "Sails", "Kicks", "Rules", "Seals", "Races", "Takes", "Moors", "Balks", "Bolts", "Turns", "Beams", "Backs", "Hides", "Fears", "Coils", "Talks", "Pokes", "Camps", "Looks", "Yelps", "Trots", "Mails", "Films", "Stars", "Mends", "Melts", "Forms", "Denys", "Gilds", "Clips", "Needs", "Fails", "Quits", "Flees", "Ruins", "Spans", "Aches", "Howls", "Snaps", "Stows", "Edits", "Jeers", "Helps", "Slows" ] , Tuple 14 [ "Cross-examines" ] , Tuple 7 [ "Alleges", "Admires", "Replies", "Brushes", "Hurries", "Happens", "Flosses", "Returns", "Snoozes", "Laments", "Offends", "Shivers", "Extolls", "Alludes", "Travels", "Invests", "Encodes", "Repairs", "Infuses", "Punches", "Reduces", "Marvels", "Borrows", "Relates", "Tries", "Expands", "Attends", "Hinders", "Retorts", "Belongs", "Barters", "Permits", "Suffers", "Bruises", "Freezes", "Assures", "Falters", "Mumbles", "Decides", "Pesters", "Berates", "Guesses", "Vouches", "Removes", "Babbles", "Dresses", "Regrets", "Listens", "Marches", "Implies", "Stashes", "Extends", "Teaches", "Handles", "Rebuffs", "Reveals", "Arrives", "Deserts", "Pledges", "Informs", "Unlocks", "Infects", "Relaxes", "Mutters", "Presses", "Jabbers", "Bestows", "Signals", "Catches", "Behaves", "Affords", "Reaches", "Concurs", "Notices", "Crashes", "Hammers", "Crushes", "Screams", "Vacuums", "Invents", "Soothes", "Forgets", "Rejects", "Escapes", "Sneezes", "Directs", "Crosses", "Empties", "Doubles", "Changes", "Reminds", "Bubbles", "Manages", "Debates", "Numbers", "Ignores", "Charges", "Asserts", "Obtains", "Gathers", "Recites", "Demands", "Affirms", "Damages", "Employs", "Chooses", "Reports", "Answers", "Divides", "Paddles", "Shrieks", "Records", "Sprouts", "Exhorts", "Scrapes", "Becomes", "Remains", "Invites", "Appears", "Appeals", "Advises", "Juggles", "Matters", "Settles", "Bellows", "Fetches", "Shampoos", "Battles", "Repeats", "Rescues", "Expects", "Carries", "Refuses", "Gardens", "Tickles", "Arrests", "Blesses", "Tumbles", "Coaches", "Injures", "Excuses", "Accepts", "Follows", "Ponders", "Unpacks", "Objects", "Depends", "Hijacks", "Insists", "Recalls", "Fastens", "Cajoles", "Retires", "Intends" ] - , Tuple 6 [ "Trains", "Broils", "Buzzes", "Quizes", "Forces", "Relies", "Copies", "Envies", "Chides", "Scolds", "Raises", "Spares", "Hovers", "Echoes", "Orders", "Teases", "Strums", "Visits", "Shades", "Thanks", "Grills", "Itches", "Quilts", "Enters", "Trusts", "Covets", "Fences", "Rushes", "Scares", "Rinses", "Alerts", "Drowns", "Fishes", "Severs", "Doubts", "Shoots", "Pedals", "Shrugs", "Begins", "Drives", "Scoffs", "Admits", "Delays", "Greets", "Breaks", "Twists", "Bastes", "Sneaks", "Utters", "Shouts", "Decays", "Snorts", "Gushes", "Stores", "Spends", "Sprays", "Lights", "Avoids", "Breeds", "Speaks", "Paints", "Senses", "Pushes", "Craves", "Sounds", "Prints", "Brings", "Phones", "Pastes", "Starts", "Cracks", "Builds", "Brakes", "Usurps", "Pleads", "Stamps", "Labels", "Places", "Yields", "Unties", "Shares", "Quotes", "Colors", "Chants", "Scoots", "Treats", "States", "Claims", "Trades", "Deters", "Toasts", "Crawls", "Agrees", "Pauses", "Croaks", "Yodels", "Sneers", "Coughs", "Tempts", "Offers", "Singes", "Brands", "Drones", "Tastes", "Drinks", "Exists", "Stuffs", "Spills", "Swoops", "Plants", "Lowers", "Cleans", "Fights", "Sleeps", "Leaves", "Crowds", "Floats", "Enjoys", "Bleeds", "Favors", "Dances", "Steers", "Tosses", "Occurs", "Misses", "Smiles", "Kneels", "Judges", "Learns", "Levels", "Merges", "Snarls", "Boasts", "Covers", "Mourns", "Growls", "Shifts", "Glides", "Slides", "Struts", "Sparks", "Blinks", "Traces", "Hisses", "Laughs", "Passes", "Blurts", "Frames", "Storms", "Founds", "Upsets", "Counts", "Adopts", "Curves", "Allows", "Dreams", "Stands", "Tracks", "Clears", "Reigns", "Tricks", "Chases", "Stunts", "Blinds", "Slices", "Climbs", "Snores", "Values", "Snoops", "Grates", "Taunts", "Knocks", "Points", "Thinks", "Causes", "Spells", "Smells", "Guides", "Elopes", "Pricks", "Smokes", "Closes", "Checks", "Haunts", "Argues", "Strays", "Unites", "Stares", "Voices", "Chomps", "Rhymes", "Guards", "Cycles", "Spoils", "Savors", "Carves", "Cheers", "Expels", "Annoys", "Shocks", "Amuses", "Skates" ] + , Tuple 6 [ "Trains", "Broils", "Buzzes", "Quizes", "Forces", "Relies", "Copies", "Envies", "Chides", "Scolds", "Raises", "Spares", "Hovers", "Echoes", "Orders", "Teases", "Strums", "Visits", "Shades", "Thanks", "Grills", "Itches", "Quilts", "Enters", "Trusts", "Covets", "Fences", "Rushes", "Scares", "Rinses", "Alerts", "Fishes", "Severs", "Doubts", "Shoots", "Pedals", "Shrugs", "Begins", "Drives", "Scoffs", "Admits", "Delays", "Greets", "Breaks", "Twists", "Bastes", "Sneaks", "Utters", "Shouts", "Decays", "Snorts", "Gushes", "Stores", "Spends", "Sprays", "Lights", "Avoids", "Breeds", "Speaks", "Paints", "Senses", "Pushes", "Craves", "Sounds", "Prints", "Brings", "Phones", "Pastes", "Starts", "Cracks", "Builds", "Brakes", "Usurps", "Pleads", "Stamps", "Labels", "Places", "Yields", "Unties", "Shares", "Quotes", "Colors", "Chants", "Scoots", "Treats", "States", "Claims", "Trades", "Deters", "Toasts", "Crawls", "Agrees", "Pauses", "Croaks", "Yodels", "Sneers", "Coughs", "Tempts", "Offers", "Singes", "Brands", "Drones", "Tastes", "Drinks", "Exists", "Stuffs", "Spills", "Swoops", "Plants", "Lowers", "Cleans", "Fights", "Sleeps", "Leaves", "Crowds", "Floats", "Enjoys", "Bleeds", "Favors", "Dances", "Steers", "Tosses", "Occurs", "Misses", "Smiles", "Kneels", "Judges", "Learns", "Levels", "Merges", "Snarls", "Boasts", "Covers", "Mourns", "Growls", "Shifts", "Glides", "Slides", "Struts", "Sparks", "Blinks", "Traces", "Hisses", "Laughs", "Passes", "Blurts", "Frames", "Storms", "Founds", "Upsets", "Counts", "Adopts", "Curves", "Allows", "Dreams", "Stands", "Tracks", "Clears", "Reigns", "Tricks", "Chases", "Stunts", "Blinds", "Slices", "Climbs", "Snores", "Values", "Snoops", "Grates", "Taunts", "Knocks", "Points", "Thinks", "Causes", "Spells", "Smells", "Guides", "Elopes", "Pricks", "Smokes", "Closes", "Checks", "Haunts", "Argues", "Strays", "Unites", "Stares", "Voices", "Chomps", "Rhymes", "Guards", "Cycles", "Spoils", "Savors", "Carves", "Cheers", "Expels", "Annoys", "Shocks", "Amuses", "Skates" ] , Tuple 11 [ "Embarrasses", "Understands", "Sympathizes", "Equivocates", "Exaggerates", "Skateboards", "Appreciates", "Strengthens", "Articulates" ] , Tuple 4 [ "Tips", "Uses", "Bats", "Ends", "Mugs", "Hops", "Sees", "Nods", "Runs", "Gets", "Mars", "Puts", "Tows", "Jogs", "Sips", "Oils", "Nags", "Bows", "Pads", "Adds", "Lies", "Does", "Cuts", "Dyes", "Naps", "Skis", "Asks", "Jams", "Pets", "Sows", "Begs", "Hums", "Bars", "Ices", "Jabs", "Robs", "Sets", "Sews", "Ties", "Bids", "Saws", "Rows", "Bets", "Acts", "Bans", "Mows", "Dies", "Rots", "Goes", "Sins", "Fits", "Drys", "Ails", "Bobs", "Owns", "Owes", "Says", "Digs", "Sobs", "Dams", "Pays", "Buys", "Pats" ] , Tuple 12 [ "Concentrates", "Communicates", "Acknowledges" ] @@ -74,7 +74,7 @@ grammaticalClasses = , Tuple 7 [ "Termite", "Buffalo", "Thought", "Produce", "Popcorn", "Dogfish", "Manatee", "Dolphin", "Chicken", "Process", "Vicuña", "Request", "Panther", "Opinion", "Feeling", "Lookout", "Control", "Payment", "Insurer", "Opossum", "Partner", "Contact", "Library", "Raccoon", "Pelican", "Sweater", "Cabbage", "Aviator", "Lapwing", "Oatmeal", "Narwhal", "Reading", "Mailbox", "Ostrich", "Officer", "Hydrant", "Disease", "Example", "History", "Hamster", "Airport", "Student", "Quarter", "Visitor", "Disgust", "Purpose", "Stretch", "Guanaco", "Haircut", "Creator", "Driving", "Gorilla", "Whistle", "Attempt", "Goshawk", "Lettuce", "Manager", "Curtain", "Caribou", "Cleaner", "Picture", "Railway", "Gazelle", "Harmony", "Octopus", "Fiction", "Tarsier", "Holiday", "Account", "Achieve", "Echidna", "Volcano", "Mammoth", "Current", "Sardine", "Thunder", "Pancake", "Brother", "Country", "Respect", "Impulse", "Morning", "Peafowl", "Giraffe", "Leopard", "Caption", "Trouble", "Balance", "Lobster", "Wallaby", "Apparel", "Stomach", "Balloon", "Comfort", "Cushion", "Company", "Penguin", "Hearing", "Meeting", "Bedroom", "Flagger", "Fighter", "Feather", "Artisan", "Station", "Science", "Hobbies", "Measure", "Channel", "Receipt", "Protest", "Writing", "Support", "Soldier", "Cheetah", "Texture", "Herring", "Journey", "Cowhand", "Laborer", "Machine", "Society", "Mallard", "Believe", "Scholar", "Weather", "Leather", "Plastic", "Insider", "Ladybug", "Quetzal", "Empress", "Emperor", "Captain", "Cashier", "Catcher", "Caterer", "Cellist", "Chemist", "Cobbler", "Courier", "Samurai", "Senator", "Surgeon", "Swimmer", "Veteran", "Athlete" ] ] , Tuple Adjective $ HM.fromArray - [ Tuple 8 [ "Grateful", "Strident", "Vigilant", "Thorough", "Splendid", "Grounded", "Attached", "Academic", "Adorable", "Metallic", "Granular", "Trusting", "Exciting", "Possible", "Ordinary", "Nautical", "Gruesome", "Thankful", "Creative", "Absolute", "Shocking", "Well-lit", "Colossal", "Jubilant", "Innocent", "Gracious", "Idolized", "Charming", "Confused", "Alarming", "Artistic", "Composed", "Anchored", "Unsteady", "Lustrous", "Majestic", "Decisive", "Precious", "Suburban", "Informal", "Distinct", "Familiar", "Advanced", "Scratchy", "Haunting", "Cheerful", "Critical", "Gleaming", "Agitated", "Careless", "Squiggly", "Impolite", "Cultured", "Fabulous", "Indolent", "Finished", "Writhing", "Striking", "Fearless", "Trifling", "Harmless", "Punctual", "Terrible", "Clueless", "Euphoric", "Favorite", "Fatherly", "Educated", "Positive", "Obedient", "Ironclad", "Friendly", "Gigantic", "Vigorous", "Vengeful", "Reckless", "Carefree", "Truthful", "Terrific", "Negative", "Horrible", "Quixotic", "Tempting", "Infamous", "Well-off", "Inferior", "Discrete", "Bustling", "Tattered", "Definite", "Wretched", "Straight", "Motherly", "Blushing", "Circular", "Detailed", "Pleasant", "Pristine", "Gripping", "Studious", "Intrepid", "Lopsided", "Physical", "Whopping", "Reliable", "Precious", "Internal", "Infinite", "Growling", "Pleasing", "Uncommon", "Spotless", "Constant", "Variable", "Standard", "Ecstatic", "Sardonic", "Flawless", "Fruitful", "Deserted", "Untimely", "Sociable", "Puzzling", "Snarling", "Dazzling", "Forsaken", "Helpless", "Generous", "Unwieldy", "Concrete", "Valuable", "Animated", "Original", "Utilized", "Blissful", "Mindless", "Grizzled", "Outlying", "Polished", "Cautious", "Required", "Handmade", "Aromatic", "Watchful", "Gullible", "Unfolded", "Glorious", "Rotating", "Specific", "Esteemed", "Stunning", "Relieved", "Wrathful", "Peaceful", "Faithful", "Menacing", "Spiteful", "Accurate", "Crushing", "Troubled", "Complete", "Perfumed", "Personal", "Graceful", "Wasteful", "Powerful", "Colorful", "Criminal", "Separate", "Periodic", "Heavenly", "Disloyal", "Slippery", "Skeletal", "Electric", "Probable", "Parallel", "Luminous", "Spirited", "Previous", "Piercing", "Frequent", "Sizzling", "Outgoing", "Superior", "Dramatic", "Scornful", "Flippant", "Adorable", "Unlawful", "Tangible", "Diligent", "Fragrant", "Youthful", "Juvenile", "Forceful", "Ultimate", "Fumbling", "Athletic", "Official", "Gorgeous", "Insecure", "Virtuous" ] + [ Tuple 8 [ "Grateful", "Strident", "Vigilant", "Thorough", "Splendid", "Grounded", "Attached", "Academic", "Adorable", "Metallic", "Granular", "Trusting", "Exciting", "Possible", "Ordinary", "Nautical", "Gruesome", "Thankful", "Creative", "Absolute", "Shocking", "Well-lit", "Colossal", "Jubilant", "Innocent", "Gracious", "Idolized", "Charming", "Confused", "Alarming", "Artistic", "Composed", "Anchored", "Unsteady", "Lustrous", "Majestic", "Decisive", "Precious", "Suburban", "Informal", "Distinct", "Familiar", "Advanced", "Scratchy", "Haunting", "Cheerful", "Critical", "Gleaming", "Agitated", "Careless", "Squiggly", "Impolite", "Cultured", "Fabulous", "Indolent", "Finished", "Writhing", "Striking", "Fearless", "Trifling", "Harmless", "Punctual", "Terrible", "Clueless", "Euphoric", "Favorite", "Fatherly", "Educated", "Positive", "Obedient", "Ironclad", "Friendly", "Gigantic", "Vigorous", "Vengeful", "Reckless", "Carefree", "Truthful", "Terrific", "Negative", "Horrible", "Quixotic", "Tempting", "Infamous", "Well-off", "Discrete", "Bustling", "Tattered", "Definite", "Wretched", "Straight", "Motherly", "Blushing", "Circular", "Detailed", "Pleasant", "Pristine", "Gripping", "Studious", "Intrepid", "Lopsided", "Physical", "Whopping", "Reliable", "Precious", "Internal", "Infinite", "Growling", "Pleasing", "Uncommon", "Spotless", "Constant", "Variable", "Standard", "Ecstatic", "Sardonic", "Flawless", "Fruitful", "Deserted", "Untimely", "Sociable", "Puzzling", "Snarling", "Dazzling", "Forsaken", "Helpless", "Generous", "Unwieldy", "Concrete", "Valuable", "Animated", "Original", "Utilized", "Blissful", "Mindless", "Grizzled", "Outlying", "Polished", "Cautious", "Required", "Handmade", "Aromatic", "Watchful", "Gullible", "Unfolded", "Glorious", "Rotating", "Specific", "Esteemed", "Stunning", "Relieved", "Wrathful", "Peaceful", "Faithful", "Menacing", "Spiteful", "Accurate", "Crushing", "Troubled", "Complete", "Perfumed", "Personal", "Graceful", "Powerful", "Colorful", "Criminal", "Separate", "Periodic", "Heavenly", "Disloyal", "Slippery", "Skeletal", "Electric", "Probable", "Parallel", "Luminous", "Spirited", "Previous", "Frequent", "Sizzling", "Outgoing", "Superior", "Dramatic", "Scornful", "Flippant", "Adorable", "Unlawful", "Tangible", "Diligent", "Fragrant", "Youthful", "Juvenile", "Forceful", "Ultimate", "Fumbling", "Athletic", "Official", "Gorgeous", "Insecure", "Virtuous" ] , Tuple 9 [ "Scholarly", "Delicious", "Indelible", "Misguided", "Excellent", "Unwilling", "Far-flung", "Glamorous", "Wonderful", "Insidious", "Unhealthy", "Impartial", "Wide-eyed", "Pointless", "Concerned", "Venerated", "Identical", "Necessary", "Brilliant", "Unnatural", "Yellowish", "Practical", "Satisfied", "Mortified", "Unsightly", "Insistent", "Qualified", "Evergreen", "Long-term", "Lumbering", "Memorable", "Imperfect", "Worrisome", "Distorted", "Political", "Well-made", "Agreeable", "Difficult", "Unequaled", "Competent", "Agonizing", "Important", "Realistic", "Monstrous", "Traumatic", "Sparkling", "Disguised", "Rewarding", "Neglected", "Flustered", "Luxurious", "Miserable", "Whispered", "Unwelcome", "Overjoyed", "Fortunate", "Marvelous", "Talkative", "Foolhardy", "Repentant", "Downright", "Surprised", "Querulous", "Firsthand", "Breakable", "Bewitched", "Imaginary", "Fantastic", "Essential", "Excitable", "Shameless", "Turbulent", "Acrobatic", "Exhausted", "Deafening", "Dishonest", "Unwritten", "Favorable", "Vivacious", "Dependent", "Ambitious", "Energetic", "Admirable", "Cavernous", "Heartfelt", "Offensive", "Unwitting", "Delirious", "Defensive", "Emotional", "Expensive", "Quizzical", "Miniature", "Clear-cut", "Enchanted", "Nocturnal", "Abandoned", "Ill-fated", "Demanding", "Spherical", "Deficient", "Acclaimed", "Palatable", "Judicious", "Beautiful", "Powerless", "Elaborate", "Sarcastic", "Grandiose", "Well-worn", "Downright", "Infantile", "Conscious", "Sorrowful", "Different", "Authentic", "Whirlwind", "Honorable", "Cluttered", "Pertinent", "Quarterly", "Grotesque", "Revolving", "Immediate", "Frivolous", "Repulsive", "Automatic", "Treasured", "Alienated", "Courteous", "Unselfish", "Hilarious", "Anguished", "Plaintive", "Whimsical", "Exemplary", "Worthless", "Secondary", "Colorless", "Bountiful", "Attentive", "Dangerous" ] , Tuple 5 [ "Minor", "Musty", "Happy", "Round", "Rowdy", "Muddy", "Ideal", "Blank", "White", "Fancy", "Smart", "Noisy", "Wrong", "Unfit", "Quick", "Major", "Joint", "Blind", "Rural", "Regal", "Dense", "Corny", "Early", "Frail", "Brisk", "Every", "Nifty", "Fixed", "Clear", "Weird", "Sandy", "Heavy", "Lumpy", "Flaky", "Sharp", "Scaly", "Scary", "Harsh", "Noted", "Salty", "Light", "Plush", "Meaty", "Sweet", "Black", "Chief", "Grave", "Wordy", "Jumpy", "Super", "Muted", "Sunny", "Curly", "Ample", "Soupy", "Adept", "Fussy", "Tense", "Young", "Equal", "Blond", "Stale", "Close", "These", "Loyal", "Naive", "Pushy", "Soggy", "Agile", "Husky", "Proud", "Jolly", "Front", "Novel", "Pesky", "Mushy", "Third", "Tepid", "Legal", "Bumpy", "Vague", "Fuzzy", "Tubby", "Funny", "Short", "Milky", "Other", "Bogus", "Prime", "Stark", "Upset", "Quiet", "Grown", "Witty", "Mealy", "Valid", "Brief", "Brown", "Steep", "Those", "Which", "Misty", "Brave", "Bulky", "Total", "Whole", "Merry", "Hefty", "Rusty", "Kooky", "Baggy", "Known", "Fluid", "Vivid", "Tired", "Clean", "Hasty", "Small", "Fresh", "Lucky", "Green", "Plain", "Urban", "Staid", "Prize", "Runny", "Vapid", "Royal", "Murky", "Silly", "Bland", "Leafy", "Alive", "Frank", "Right", "Rough", "Weary", "Tough", "Cruel", "Messy", "Spicy", "Livid", "Great", "Eager", "Bowed", "Lanky", "Weepy", "Loose", "Grimy", "Shiny", "Itchy", "False", "Ready", "Hairy", "Ruddy", "Angry", "Jaded", "Jumbo", "Empty", "Crisp", "Fatal", "Bossy", "Moral", "First", "Giddy", "Woozy", "Rapid", "Moist", "Faint", "Dizzy", "Steel", "Glass", "Aware", "Minty", "Dopey", "Gross", "Yummy", "Zesty", "Grand", "Lined", "Gummy", "Tight", "Vital", "Solid", "Silky", "Basic", "Bleak", "Burly", "Swift", "Tasty", "Handy", "Alert", "Testy", "Windy", "Dirty", "Utter", "Giant", "Showy", "Mixed", "Shady" ] , Tuple 6 [ "Closed", "Somber", "Hoarse", "Flimsy", "Annual", "Giving", "Medium", "Humble", "Feisty", "Poised", "Zigzag", "Intent", "Ringed", "Amused", "Common", "Feline", "Coarse", "Expert", "Clumsy", "Square", "Bitter", "Lively", "Creepy", "Warped", "Pretty", "Subtle", "Sweaty", "Nimble", "Fickle", "Strict", "Shoddy", "Pastel", "Unripe", "Dreary", "Untidy", "Stormy", "Barren", "Famous", "Stable", "Homely", "Severe", "Frosty", "Putrid", "Untrue", "Hearty", "Sneaky", "Shabby", "Frugal", "Oblong", "Greedy", "Edible", "Direct", "Hidden", "Acidic", "Silver", "Sugary", "Sudden", "Usable", "Mellow", "Cloudy", "Wilted", "Silent", "Female", "Lonely", "Actual", "Tragic", "Bronze", "Unruly", "Entire", "Fluffy", "Loving", "Grumpy", "Liquid", "Oblong", "Modest", "Paltry", "Droopy", "Slushy", "Creamy", "Secret", "Decent", "Wobbly", "Quirky", "Measly", "Thorny", "Hollow", "Lavish", "Klutzy", "Queasy", "Inborn", "Stingy", "Guilty", "Bouncy", "Upbeat", "Strong", "Unsung", "Knobby", "Normal", "Linear", "Gentle", "Hungry", "Sleepy", "Yellow", "Smooth", "Gloomy", "Boring", "Frayed", "Pricey", "Polite", "French", "Formal", "Robust", "Watery", "Uneven", "Joyful", "Second", "Little", "Trusty", "Useful", "Flawed", "Frizzy", "Wiggly", "Ragged", "Joyous", "Kindly", "Jaunty", "Dental", "Superb", "Yearly", "Costly", "Winged", "Drafty", "Tender", "Gifted", "Cheery", "Forked", "Dapper", "Dreary", "Timely", "Wooden", "Frozen", "Mature", "Crafty", "Single", "Stupid", "Golden", "Lawful", "Flashy", "Glossy", "Aching", "Doting", "Frilly", "Snappy", "Wicked", "Sinful", "Kosher", "Speedy", "Dismal", "Elated", "Exotic", "Modern", "Portly", "Starry", "Unique", "United", "Bright", "Impish", "Jagged", "Honest", "Remote", "Quaint", "Knotty", "Narrow", "Smoggy", "Sparse", "Impure", "Tricky", "Chilly", "Active", "Skinny", "Proper", "Afraid", "Rotten", "Worthy", "Cooked", "Scarce", "Violet", "Scared", "Filthy", "Purple", "Arctic", "Likely", "Clever", "Shrill", "Canine", "Weekly", "Orange", "Better", "Lovely", "Webbed", "Spiffy", "Woeful", "Double", "Candid", "Dismal", "Adored", "Unused", "Jovial", "Ornery", "Cuddly", "Svelte", "Caring", "Frigid", "Broken", "Junior", "Sturdy", "Ornate", "Serene", "Tinted", "Deadly", "Bubbly", "Recent", "Grubby", "Slight", "Meager", "Snoopy", "Vacant", "Simple", "Daring" ] @@ -107,7 +107,7 @@ grammaticalClasses = , Tuple PluralNoun $ HM.fromArray [ Tuple 11 [ "Comparisons", "Cassowaries", "Toothpastes", "Salamanders", "Polar Bears", "Plantations", "Goldfinches", "Volleyballs", "Playgrounds", "Experiences", "Fellowships", "Butterflies", "Chinchillas", "Arithmetics", "Suggestions", "Earthquakes", "Basketballs", "Calculators", "Sea Urchins", "Punishments", "Secretaries", "Albatrosses", "Attractions", "Connections", "Apparatuses", "Jellyfishes", "Discussions", "Instruments", "Adjustments", "Guinea Pigs", "Authorities", "Territories", "Compatriots", "Chimpanzees", "Governments", "Dragonflies", "Discoveries", "Cab Drivers", "Cartoonists", "Contractors", "Salespeople", "Ambassadors", "Astronomers", "Auctioneers", "Undertakers" ] , Tuple 8 [ "Termites", "Thoughts", "Produces", "Popcorns", "Manatees", "Dolphins", "Chickens", "Vicuñas", "Requests", "Panthers", "Opinions", "Feelings", "Lookouts", "Controls", "Payments", "Potatoes", "Insurers", "Quartzes", "Opossums", "Partners", "Contacts", "Raccoons", "Sweaters", "Cabbages", "Aviators", "Stitches", "Lapwings", "Oatmeals", "Memories", "Narwhals", "Readings", "Recesses", "Hydrants", "Diseases", "Examples", "Hamsters", "Airports", "Students", "Quarters", "Visitors", "Disgusts", "Canvases", "Purposes", "Haircuts", "Churches", "Creators", "Drivings", "Gorillas", "Whistles", "Attempts", "Cactuses", "Goshawks", "Lettuces", "Managers", "Curtains", "Caribous", "Polishes", "Cleaners", "Pictures", "Railways", "Gazelles", "Fictions", "Tarsiers", "Holidays", "Accounts", "Achieves", "Echidnas", "Mammoths", "Currents", "Sardines", "Thunders", "Pancakes", "Brothers", "Theories", "Cherries", "Respects", "Impulses", "Mornings", "Peafowls", "Giraffes", "Leopards", "Captions", "Troubles", "Balances", "Shooters", "Lobsters", "Apparels", "Balloons", "Comforts", "Cushions", "Penguins", "Hearings", "Meetings", "Bedrooms", "Branches", "Flaggers", "Fighters", "Feathers", "Artisans", "Stations", "Sciences", "Measures", "Channels", "Receipts", "Protests", "Writings", "Supports", "Soldiers", "Celeries", "Wrenches", "Cheetahs", "Textures", "Herrings", "Journeys", "Cowhands", "Laborers", "Machines", "Mallards", "Believes", "Scholars", "Weathers", "Leathers", "Plastics", "Insiders", "Ladybugs", "Quetzals", "Emperors", "Captains", "Cashiers", "Catchers", "Caterers", "Cellists", "Chemists", "Cobblers", "Coroners", "Couriers", "Samurais", "Senators", "Sweepers", "Surgeons", "Swimmers", "Veterans", "Athletes" ] - , Tuple 4 [ "Gods", "Yaks", "Cubs", "Ices", "Nets", "Cans", "Arts", "Rays", "Cods", "Zoos", "Ants", "Gnus", "Caps", "Pigs", "Rubs", "Vans", "Jars", "Hots", "Emus", "Arms", "Fans", "Keys", "Dogs", "Lips", "Apes", "Beds", "Rams", "Pots", "Ears", "Cups", "Legs", "Wars", "Rods", "Runs", "Airs", "Eggs", "Maps", "Inks", "Days", "Pets", "Eels", "Eyes", "Uses", "Acts", "Tubs", "Seas", "Hats", "Tins", "Fogs", "Jams", "Lows", "Elks", "Bats", "Owls", "Jays", "Cars", "Pans", "Hens", "Suns", "Pies", "Ways", "Cats", "Pins", "Yams", "Toes", "Buns", "Bees", "Oils", "Bits", "Ends", "Ones" ] + , Tuple 4 [ "Gods", "Yaks", "Cubs", "Ices", "Nets", "Cans", "Arts", "Rays", "Cods", "Zoos", "Ants", "Gnus", "Caps", "Pigs", "Vans", "Jars", "Hots", "Emus", "Arms", "Fans", "Keys", "Dogs", "Lips", "Apes", "Beds", "Rams", "Pots", "Ears", "Cups", "Legs", "Wars", "Rods", "Runs", "Airs", "Eggs", "Maps", "Inks", "Days", "Pets", "Eels", "Eyes", "Uses", "Acts", "Tubs", "Seas", "Hats", "Tins", "Fogs", "Jams", "Lows", "Elks", "Bats", "Owls", "Jays", "Cars", "Pans", "Hens", "Suns", "Pies", "Ways", "Cats", "Pins", "Yams", "Toes", "Buns", "Bees", "Oils", "Bits", "Ends", "Ones" ] , Tuple 13 [ "Choir Members", "Distributions", "Faith Healers", "Superstitions", "Water Buffalo", "Stegosauruses", "Afterthoughts", "Organizations", "Entomologists", "Entrepreneurs", "Exterminators", "Calligraphers", "Cardiologists", "Cartographers", "Mail Carriers", "Manufacturers", "Statisticians", "Veterinarians" ] , Tuple 15 [ "Representatives", "Press Operators", "Security Guards", "Business people" ] , Tuple 14 [ "Komodo Dragons", "Brew Directors", "Spirit Healers", "Chorus Singers", "Postal Workers", "Elephant Seals", "Advertisements", "Cryptographers", "Mathematicians" ] diff --git a/src/Server/Configuration.purs b/src/Server/Configuration.purs index b23e8566..ed95314e 100644 --- a/src/Server/Configuration.purs +++ b/src/Server/Configuration.purs @@ -18,9 +18,9 @@ readConfiguration ∷ Effect Configuration readConfiguration = if production then do port ← parsePort <$> NP.lookupEnv "PORT" - variables ← DT.traverse getVariable [ "CAPTCHA_SECRET", "TOKEN_SECRET", "SALT", "EMAIL_USER", "EMAIL_HOST", "EMAIL_PASSWORD", "DATABASE_HOST", "STORAGE_APPLICATION_ID", "STORAGE_APPLICATION_KEY", "ADMIN_SECRET" ] + variables ← DT.traverse getVariable [ "CAPTCHA_SECRET", "TOKEN_SECRET", "SALT", "EMAIL_USER", "EMAIL_HOST", "EMAIL_PASSWORD", "DATABASE_HOST", "ADMIN_SECRET" ] case variables of - [ captchaSecret, tokenSecret, salt, emailUser, emailHost, emailPassword, host, storageApplicationKeyId, storageApplicationKey, adminSecret ] → + [ captchaSecret, tokenSecret, salt, emailUser, emailHost, emailPassword, host, adminSecret ] → pure $ { port , databaseHost: Just host @@ -30,8 +30,6 @@ readConfiguration = , emailUser , emailHost , emailPassword - , storageApplicationKeyId - , storageApplicationKey , adminSecret } _ → EE.throw "Wrong number of environment variables" @@ -44,8 +42,6 @@ readConfiguration = , tokenSecret: "so nice, so nice, I got you" , salt: "put it back together" , emailUser: "" - , storageApplicationKey: "" - , storageApplicationKeyId: "" , adminSecret: "" , emailHost: "" , emailPassword: "" diff --git a/src/Server/Effect.purs b/src/Server/Effect.purs index c058d29b..9ecaef7d 100644 --- a/src/Server/Effect.purs +++ b/src/Server/Effect.purs @@ -19,8 +19,6 @@ type Configuration = { port ∷ Int , captchaSecret ∷ String , adminSecret ∷ String - , storageApplicationKey ∷ String - , storageApplicationKeyId ∷ String , tokenSecret ∷ String , salt ∷ String , databaseHost ∷ Maybe String diff --git a/src/Server/File.js b/src/Server/File.js index 7b0060f8..75602962 100644 --- a/src/Server/File.js +++ b/src/Server/File.js @@ -1,17 +1,5 @@ -import b2 from 'b2-js'; import imageType from 'image-type'; -let b, bucket; - -export async function init_(applicationKeyId, applicationKey) { - b = await b2.default.authorize({ applicationKeyId, applicationKey }); - bucket = await b.bucket('ourmelon'); -} - -export async function upload_(fileName, buffer) { - await bucket.upload('upload/' + fileName, buffer); -} - export function realFileExtension_(buffer) { return async function() { let r = await imageType(buffer); diff --git a/src/Server/File.purs b/src/Server/File.purs index fa8010fc..51fe3151 100644 --- a/src/Server/File.purs +++ b/src/Server/File.purs @@ -2,46 +2,32 @@ module Server.File where import Prelude -import Data.Foldable as FD +import Control.Promise (Promise) +import Control.Promise as CP +import Data.Either (Either(..)) import Data.HashMap as DH +import Data.Maybe (Maybe(..)) +import Data.Set (member) as DS import Data.String (Pattern(..)) -import Data.String as DS +import Data.String (split) as DS import Data.UUID as DU import Effect (Effect) -import Effect.Class (liftEffect) -import Effect.Uncurried (EffectFn1, EffectFn2) -import Effect.Uncurried as EU -import Environment (production) +import Effect.Aff (Aff) import Node.Buffer (Buffer) import Node.Buffer as NB -import Effect.Aff (Aff) -import Node.FS.Sync as NFS import Node.Encoding (Encoding(..)) import Node.FS.Aff as NFA -import Data.Maybe (Maybe(..)) import Run as R -import Data.Set as DS -import Server.Response as SR import Server.Effect (BaseEffect, Configuration) -import Shared.Options.File -import Shared.Unsafe as SU -import Control.Promise (Promise) -import Control.Promise as CP - -foreign import init_ ∷ EffectFn2 String String Unit -foreign import upload_ ∷ EffectFn2 String Buffer Unit +import Server.Response as SR +import Shared.Resource (Media(..), ResourceType(..), allowedExtensions, allowedMediaTypes, maxImageSize, maxImageSizeKB) +import Shared.Resource as SP foreign import realFileExtension_ ∷ Buffer → Effect (Promise String) realFileExtension ∷ Buffer → Aff String realFileExtension buffer = CP.toAffE $ realFileExtension_ buffer -upload ∷ String → Buffer → Effect Unit -upload = EU.runEffectFn2 upload_ - -init ∷ String → String → Effect Unit -init = EU.runEffectFn2 init_ - invalidImageMessage ∷ String invalidImageMessage = "Invalid image" @@ -64,13 +50,7 @@ saveBase64File input = if DS.member extension allowedExtensions then do uuid ← R.liftEffect (DU.toString <$> DU.genUUID) let fileName = uuid <> extension - if production then - liftEffect $ upload fileName buffer - else do - let localPath = "src/Client/media/upload/" - exists ← R.liftEffect $ NFS.exists localPath - unless exists <<< R.liftAff $ NFA.mkdir localPath - R.liftAff $ NFA.writeFile (localPath <> fileName) buffer + R.liftAff $ NFA.writeFile (SP.resourcePath (Left $ Upload fileName) Ignore) buffer pure fileName else invalidImage diff --git a/src/Server/Handler.purs b/src/Server/Handler.purs index cdce1494..446ee36d 100644 --- a/src/Server/Handler.purs +++ b/src/Server/Handler.purs @@ -5,8 +5,7 @@ import Server.Effect import Data.Either (Either(..)) import Data.List (List(..)) -import Data.List as DL -import Data.String as DS +import Debug (spy) import Effect.Aff (Aff) import Effect.Aff as EA import Effect.Class (liftEffect) @@ -20,6 +19,8 @@ import Run.Except as RE import Run.Reader as RR import Server.Admin.Handler as SHA import Server.Backer.Handler as SBH +import Server.Banned.Handler as SBNH +import Server.Elsewhere.Handler as SESH import Server.Experiments.Handler as SEH import Server.Feedback.Handler as SFH import Server.Fortune.Handler as SFTH @@ -28,8 +29,6 @@ import Server.Im.Handler as SIH import Server.InternalBacker.Handler as SIBH import Server.InternalError.Handler as SIEH import Server.InternalHelp.Handler as SIHH -import Server.Elsewhere.Handler as SESH -import Server.Banned.Handler as SBNH import Server.KarmaPrivileges.Handler as SLBH import Server.Landing.Handler as SLH import Server.Login.Handler as SLGH @@ -40,6 +39,7 @@ import Server.Profile.Handler as SPH import Server.Recover.Handler as SRH import Server.Settings.Handler as SSH import Server.Unsubscribe.Handler as SUH +import Shared.Resource (localBasePath) import Shared.ResponseError (ResponseError(..)) import Shared.Routes (routes) @@ -141,13 +141,6 @@ runJson reading handler = developmentFiles ∷ { params ∷ { path ∷ List String } } → Aff File developmentFiles { params: { path } } = PSH.file fullPath {} where - clientBaseFolder = "src/Client/" - distBaseFolder = "dist/development/" fullPath = case path of - Cons "media" (Cons file Nil) → clientBaseFolder <> "media/" <> file - Cons "media" (Cons "upload" (Cons file Nil)) → clientBaseFolder <> "media/upload/" <> file - --js files are expected to be named like module.bundle.js - -- they are served from webpack output - Cons "javascript" (Cons file Nil) → distBaseFolder <> file - Cons folder (Cons file Nil) → clientBaseFolder <> folder <> "/" <> file - _ → distBaseFolder <> DS.joinWith "/" (DL.toUnfoldable path) \ No newline at end of file + Cons folder (Cons file Nil) → localBasePath <> folder <> "/" <> file + _ → "notfound" \ No newline at end of file diff --git a/src/Server/Im/Action.purs b/src/Server/Im/Action.purs index 2bdcfc98..32903f29 100644 --- a/src/Server/Im/Action.purs +++ b/src/Server/Im/Action.purs @@ -111,7 +111,7 @@ processMessageContent content privileges = do Text m | allowed m → pure m Image caption base64 | DST.member SendImages privileges → do name ← SF.saveBase64File base64 - pure $ "![" <> caption <> "](" <> SP.mediaPath (Upload name) Included <> ")" + pure $ "![" <> caption <> "](" <> SP.resourcePath (Left $ Upload name) Ignore <> ")" _ → pure "" pure <<< DS.trim $ SS.sanitize message where diff --git a/src/Server/Im/Template.purs b/src/Server/Im/Template.purs index d63a5daf..f99a9d89 100644 --- a/src/Server/Im/Template.purs +++ b/src/Server/Im/Template.purs @@ -91,6 +91,6 @@ template { contacts, suggestions, user } = do height:20px; } .suggestion.new { - background: url(https://static.mero.chat/file/ourmelon/suggestions.png); + background: url(https://static.mero.chat/file/default/suggestions.png); }""" ] diff --git a/src/Server/Landing/Template.purs b/src/Server/Landing/Template.purs index 71647c9c..2a45600c 100644 --- a/src/Server/Landing/Template.purs +++ b/src/Server/Landing/Template.purs @@ -2,6 +2,7 @@ module Server.Landing.Template where import Prelude +import Data.Either (Either(..)) import Data.String as DS import Effect (Effect) import Environment (production) @@ -40,9 +41,9 @@ template = do [ HE.div (HA.class' "landing") [ HE.div (HA.class' "header") [ HE.a [ HA.href $ routes.landing {}, HA.class' "logo" ] $ HE.img - [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.mediaPath Logo3Small Png, "180w,", SP.mediaPath Logo Png, "250w,", SP.mediaPath LogoSmall Png, "210w" ] + [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.resourcePath (Left Logo3Small) Png, "180w,", SP.resourcePath (Left Logo) Png, "250w,", SP.resourcePath (Left LogoSmall) Png, "210w" ] , HA.createAttribute "sizes" "(max-width: 1365px) 180px, (max-width: 1919px) 210px, 250px" - , HA.src $ SP.mediaPath Logo Png + , HA.src $ SP.resourcePath (Left Logo) Png ] , HE.div [ HA.class' "login-box" ] $ HE.a [ HA.class' "login", HA.href $ routes.login.get {} ] "Login" ] @@ -89,7 +90,7 @@ template = do , HE.div (HA.class' "first-points") [ HE.div (HA.class' "point-column") [ HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point1 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point1) Png ] , HE.br , HE.text "No sleazy people!" , HE.br @@ -98,7 +99,7 @@ template = do , HE.text "to have actual conversations" ] , HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point4 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point4) Png ] , HE.br , HE.text "Community driven:" , HE.br @@ -109,7 +110,7 @@ template = do ] , HE.div (HA.class' "point-column") [ HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point2 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point2) Png ] , HE.br , HE.text "Set the privacy level you" , HE.br @@ -118,7 +119,7 @@ template = do , HE.text "Safe, anonymous and ad free" ] , HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point5 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point5) Png ] , HE.br , HE.text "Ultra fancy algorithms" , HE.br @@ -129,7 +130,7 @@ template = do ] , HE.div (HA.class' "point-column") [ HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point3 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point3) Png ] , HE.br , HE.text "Feeling uninspired?" , HE.br @@ -138,7 +139,7 @@ template = do , HE.text "or suggest what to say" ] , HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point6 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point6) Png ] , HE.br , HE.text "Send text, image & audio messages." , HE.br @@ -150,7 +151,7 @@ template = do ] , HE.div (HA.class' "second-point") [ HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Point7 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Point7) Png ] , HE.br , HE.text "Full of watermelons!" ] @@ -160,7 +161,7 @@ template = do ] , HE.div (HA.class' "third-points") [ HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Works1 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Works1) Png ] , HE.br , HE.text "New users randomized account needs Karma to access" , HE.br @@ -172,7 +173,7 @@ template = do , HE.text "Creeps get weeded out; interesting folks get more visibility" ] , HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Works2 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Works2) Png ] , HE.br , HE.text "Whenever you feel like chatting, MeroChat suggests" , HE.br @@ -184,7 +185,7 @@ template = do , HE.text "You decide what to share and who to share it with" ] , HE.div (HA.class' "point") - [ HE.img [ HA.class' "point-melon", HA.src $ SP.mediaPath Works3 Png ] + [ HE.img [ HA.class' "point-melon", HA.src $ SP.resourcePath (Left Works3) Png ] , HE.br , HE.text "Want to take a break, or delete your account forever?" , HE.br diff --git a/src/Server/Main.purs b/src/Server/Main.purs index 7ce7435b..754df6ec 100644 --- a/src/Server/Main.purs +++ b/src/Server/Main.purs @@ -8,12 +8,10 @@ import Effect.Aff as EA import Effect.Console as EC import Effect.Ref as ER import Effect.Timer as ET -import Environment (production) import Payload.Server (defaultOpts) import Payload.Server as PS import Server.Configuration as CF import Server.Database as SD -import Server.File as SF import Server.Guard (guards) import Server.Handler as SH import Server.Effect (Configuration) @@ -26,8 +24,7 @@ import Shared.Spec (spec) main ∷ Effect Unit main = do - configuration@{ storageApplicationKeyId, storageApplicationKey } ← CF.readConfiguration - when production $ SF.init storageApplicationKeyId storageApplicationKey + configuration ← CF.readConfiguration startWebSocketServer configuration startHttpServer configuration diff --git a/src/Server/Profile/Action.purs b/src/Server/Profile/Action.purs index 24820f3d..eda853c5 100644 --- a/src/Server/Profile/Action.purs +++ b/src/Server/Profile/Action.purs @@ -4,6 +4,7 @@ import Prelude import Shared.Options.Profile import Data.Array as DA +import Data.Either (Either(..)) import Data.Maybe (Maybe(..)) import Data.Maybe as DM import Data.Newtype as DN @@ -11,19 +12,20 @@ import Data.String (Pattern(..), Replacement(..)) import Data.String as DS import Run as R import Server.Database.Privileges as SDP +import Server.Effect (ServerEffect) import Server.File as SF import Server.Profile.Database as SPD import Server.Profile.Database.Flat as SPDF import Server.Profile.Types (Payload) import Server.Response as SR +import Server.Sanitize as SS import Server.ThreeK as ST -import Server.Effect (ServerEffect) import Shared.DateTime (DateWrapper) import Shared.DateTime as SDT import Shared.Privilege (Privilege(..)) import Shared.Profile.Types (What(..)) -import Server.Sanitize as SS -import Shared.Resource (uploadedImagePath) +import Shared.Resource (Media(..), ResourceType(..)) +import Shared.Resource as SRS import Shared.User (Gender) tooYoungMessage ∷ String @@ -57,7 +59,7 @@ saveAvatar loggedUserId base64 = do avatar ← case base64 of Nothing → pure Nothing Just path → do - let fileName = DS.replace (Pattern uploadedImagePath) (Replacement "") path + let fileName = DS.replace (Pattern $ SRS.resourcePath (Left $ Upload "") Ignore) (Replacement "") path --likely a base64 image if fileName == path then Just <$> SF.saveBase64File path diff --git a/src/Server/Template.purs b/src/Server/Template.purs index 74d556dd..40fe4fc4 100644 --- a/src/Server/Template.purs +++ b/src/Server/Template.purs @@ -3,6 +3,7 @@ module Server.Template where import Prelude +import Data.Either (Either(..)) import Data.String as DS import Effect (Effect) import Flame (Html) @@ -25,7 +26,7 @@ type Parameters a = defaultParameters ∷ ∀ a. Parameters a defaultParameters = { title: "MeroChat - Friendly Random Chat" - , favicon: SP.mediaPath Favicon Ico + , favicon: SP.resourcePath (Left Favicon) Ico , javascript: [] , css: [] , --REFACTOR: should just be a list of file names @@ -43,9 +44,9 @@ externalDefaultParameters = defaultParameters [ HE.div (HA.class' "header") [ HE.a [ HA.href $ routes.landing {}, HA.class' "logo" ] $ HE.img - [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.mediaPath Logo3Small Png, "180w,", SP.mediaPath Logo Png, "250w,", SP.mediaPath LogoSmall Png, "210w" ] + [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.resourcePath (Left Logo3Small) Png, "180w,", SP.resourcePath (Left Logo) Png, "250w,", SP.resourcePath (Left LogoSmall) Png, "210w" ] , HA.createAttribute "sizes" "(max-width: 1365px) 180px, (max-width: 1919px) 210px, 250px" - , HA.src $ SP.mediaPath Logo Png + , HA.src $ SP.resourcePath (Left Logo) Png ] ] ] @@ -85,7 +86,7 @@ templateWith parameters@{ title, content, css, bundled, footer, favicon } = externalFooter ∷ ∀ a. Html a externalFooter = HE.div (HA.class' "footer") - [ HE.a (HA.href $ routes.landing {}) <<< HE.img <<< HA.src $ SP.mediaPath LogoSmall Png + [ HE.a (HA.href $ routes.landing {}) <<< HE.img <<< HA.src $ SP.resourcePath (Left LogoSmall) Png , HE.ul (HA.class' "footer-menu") [ HE.li_ $ HE.a (HA.href $ routes.login.get {}) "Login" , HE.li_ $ HE.a (HA.href $ routes.help {} <> "#faq") "FAQ" diff --git a/src/Shared/Avatar.purs b/src/Shared/Avatar.purs index cb4e5cee..156c1291 100644 --- a/src/Shared/Avatar.purs +++ b/src/Shared/Avatar.purs @@ -2,6 +2,7 @@ module Shared.Avatar where import Prelude +import Data.Either (Either(..)) import Data.Maybe (Maybe) import Data.Maybe as DM import Effect (Effect) @@ -23,7 +24,7 @@ differentAvatarImages ∷ Int differentAvatarImages = 8 avatarPath ∷ Int → String -avatarPath index = SP.mediaPath name Png +avatarPath index = SP.resourcePath (Left name) Png where name = case index of 1 → Avatar1 @@ -51,7 +52,7 @@ avatarColorClass index = className <> show (mod (SU.fromJust index) totalColorCl totalColorClasses = 4 parseAvatar ∷ Maybe String → Maybe String -parseAvatar av = (\a → SP.mediaPath (Upload a) Included) <$> av +parseAvatar av = (\a → SP.resourcePath (Left $ Upload a) Ignore) <$> av async ∷ ∀ message. NodeData message async = HA.createAttribute "async" "" diff --git a/src/Shared/Experiments/Impersonation.purs b/src/Shared/Experiments/Impersonation.purs index 898a392d..b4802cf3 100644 --- a/src/Shared/Experiments/Impersonation.purs +++ b/src/Shared/Experiments/Impersonation.purs @@ -1,15 +1,16 @@ module Shared.Experiments.Impersonation where import Prelude +import Shared.Availability import Shared.Experiments.Types import Shared.User import Client.Common.Privilege as CCP import Data.Array as DA +import Data.Either (Either(..)) import Data.HashMap (HashMap) import Data.HashMap as DH import Data.Maybe (Maybe(..)) -import Shared.Availability import Data.Maybe as DM import Data.Tuple (Tuple(..)) import Flame (Html) @@ -81,7 +82,7 @@ batman = , typingStatus: true , onlineStatus: true , completedTutorial: true - , avatar: Just $ SP.mediaPath BatmanNounProjectAnushaNarvekar Png + , avatar: Just $ SP.resourcePath (Left BatmanNounProjectAnushaNarvekar) Png , headline: "*raspy voice* I am Batman" , description: "I am not afraid of bats. Don't tell Robin I am here." , tags: [ "Martial arts", "Detective work", "Costumes", "Bats" ] @@ -100,7 +101,7 @@ socrates ∷ ImpersonationProfile socrates = { id: 2 , name: "Socrates" - , avatar: Just $ SP.mediaPath SocratesStingWikimedia Png + , avatar: Just $ SP.resourcePath (Left SocratesStingWikimedia) Png , headline: "I know that I know nothing" , profileVisibility: Everyone , availability: None @@ -131,7 +132,7 @@ nicolasCage ∷ ImpersonationProfile nicolasCage = { id: 3 , name: "Nicolas Cage" - , avatar: Just $ SP.mediaPath NicolasCageHiclipart Png + , avatar: Just $ SP.resourcePath (Left NicolasCageHiclipart) Png , headline: "I think I jump around more when I'm alone" , profileVisibility: Everyone , readReceipts: true diff --git a/src/Shared/Im/Unread.purs b/src/Shared/Im/Unread.purs index e81cea91..39f4af96 100644 --- a/src/Shared/Im/Unread.purs +++ b/src/Shared/Im/Unread.purs @@ -2,6 +2,7 @@ module Shared.Im.Unread where import Prelude +import Data.Either (Either(..)) import Data.Foldable as DF import Data.String (Pattern(..), Replacement(..)) import Data.String as DS @@ -20,18 +21,18 @@ title = favicon ∷ Int → String favicon = case _ of - 0 → SP.mediaPath Favicon Ico - 1 → SP.mediaPath Favicon1 Ico - 2 → SP.mediaPath Favicon2 Ico - 3 → SP.mediaPath Favicon3 Ico - 4 → SP.mediaPath Favicon4 Ico - 5 → SP.mediaPath Favicon5 Ico - 6 → SP.mediaPath Favicon6 Ico - 7 → SP.mediaPath Favicon7 Ico - 8 → SP.mediaPath Favicon8 Ico - 9 → SP.mediaPath Favicon9 Ico - 10 → SP.mediaPath Favicon10 Ico - _ → SP.mediaPath Favicon10Plus Ico + 0 → SP.resourcePath (Left Favicon) Ico + 1 → SP.resourcePath (Left Favicon1) Ico + 2 → SP.resourcePath (Left Favicon2) Ico + 3 → SP.resourcePath (Left Favicon3) Ico + 4 → SP.resourcePath (Left Favicon4) Ico + 5 → SP.resourcePath (Left Favicon5) Ico + 6 → SP.resourcePath (Left Favicon6) Ico + 7 → SP.resourcePath (Left Favicon7) Ico + 8 → SP.resourcePath (Left Favicon8) Ico + 9 → SP.resourcePath (Left Favicon9) Ico + 10 → SP.resourcePath (Left Favicon10) Ico + _ → SP.resourcePath (Left Favicon10Plus) Ico countUnreadChats ∷ Int → Array Contact → Int countUnreadChats id = DF.foldl count 0 diff --git a/src/Shared/Im/View/ChatInput.purs b/src/Shared/Im/View/ChatInput.purs index 20244823..b5da95b6 100644 --- a/src/Shared/Im/View/ChatInput.purs +++ b/src/Shared/Im/View/ChatInput.purs @@ -1,6 +1,7 @@ module Shared.Im.View.ChatInput where import Prelude +import Shared.Availability import Shared.Im.Types import Shared.User @@ -14,7 +15,6 @@ import Data.Maybe as DM import Data.Symbol as TDS import Data.Tuple (Tuple(..)) import Data.Tuple as DT -import Shared.Availability import Debug (spy) import Flame (Html) import Flame.Html.Attribute as HA @@ -24,9 +24,9 @@ import Shared.Experiments.Impersonation (impersonations) import Shared.Im.Emoji as SIE import Shared.Im.Svg as SIS import Shared.Keydown as SK -import Shared.Options.File (maxImageSizeKB) import Shared.Privilege (Privilege(..)) import Shared.Privilege as SP +import Shared.Resource (maxImageSizeKB) import Shared.Setter as SS import Type.Proxy (Proxy(..)) diff --git a/src/Shared/Im/View/LogoMenu.purs b/src/Shared/Im/View/LogoMenu.purs index 30b9b78e..75fd0405 100644 --- a/src/Shared/Im/View/LogoMenu.purs +++ b/src/Shared/Im/View/LogoMenu.purs @@ -3,6 +3,7 @@ module Shared.Im.View.LogoMenu where import Prelude import Shared.Im.Types +import Data.Either (Either(..)) import Data.Maybe (Maybe) import Data.Maybe as DM import Data.String as DS @@ -48,8 +49,8 @@ logoMenu fortune = HE.div (HA.class' "relative") ] , HE.div [ HA.class' "logo-contact-list", HA.onDblclick $ ToggleFortune true ] $ HE.img - [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.mediaPath Logo3Small Png, "180w,", SP.mediaPath LogoSmall Png, "210w" ] + [ HA.createAttribute "srcset" $ DS.joinWith " " [ SP.resourcePath (Left Logo3Small) Png, "180w,", SP.resourcePath (Left LogoSmall) Png, "210w" ] , HA.createAttribute "sizes" "(max-width: 1920px) 180px, 210px" - , HA.src $ SP.mediaPath Logo Png + , HA.src $ SP.resourcePath (Left Logo) Png ] ] \ No newline at end of file diff --git a/src/Shared/Options/File.purs b/src/Shared/Options/File.purs deleted file mode 100644 index f47175e5..00000000 --- a/src/Shared/Options/File.purs +++ /dev/null @@ -1,37 +0,0 @@ -module Shared.Options.File where - -import Prelude - -import Data.HashMap (HashMap) -import Data.HashMap as DH -import Data.Tuple (Tuple(..)) -import Data.Set as DS -import Data.Array as DA -import Data.Set (Set) - -allowedMediaTypes ∷ HashMap String String -allowedMediaTypes = DH.fromFoldable <<< DA.zip [ "data:image/png;base64", "data:image/jpeg;base64", "data:image/tiff;base64", "data:image/bmp;base64", "data:image/gif;base64" ] $ DS.toUnfoldable allowedExtensions - -allowedExtensions ∷ Set String -allowedExtensions = DS.fromFoldable [ ".png", ".jpg", ".tiff", ".bmp", ".gif" ] - -base ∷ Int -base = 1000 - -maxImageSize ∷ Int -maxImageSize = base * 1024 - -maxImageSizeKB ∷ String -maxImageSizeKB = show base <> " KB" - -productionBasePath ∷ String -productionBasePath = "https://static.mero.chat/file/ourmelon/" - -developmentImageBasePath ∷ String -developmentImageBasePath = "/client/media/" - -developmentJsBasePath ∷ String -developmentJsBasePath = "/client/javascript/" - -developmentCssBasePath ∷ String -developmentCssBasePath = "/client/css/" diff --git a/src/Shared/Resource.purs b/src/Shared/Resource.purs index ee3cead1..de95257b 100644 --- a/src/Shared/Resource.purs +++ b/src/Shared/Resource.purs @@ -2,18 +2,23 @@ module Shared.Resource where import Prelude +import Data.Array as DA import Data.Either (Either(..)) import Data.Either as DE import Data.HashMap (HashMap) import Data.HashMap as DH -import Data.Tuple (Tuple(..)) +import Data.Set (Set) +import Data.Set as DS import Environment (production) allowedMediaTypes ∷ HashMap String String -allowedMediaTypes = DH.fromFoldable [ Tuple "data:image/png;base64" ".png", Tuple "data:image/jpeg;base64" ".jpg", Tuple "data:image/tiff;base64" ".tiff", Tuple "data:image/bmp;base64" ".bmp" ] +allowedMediaTypes = DH.fromFoldable <<< DA.zip [ "data:image/png;base64", "data:image/jpeg;base64", "data:image/tiff;base64", "data:image/bmp;base64", "data:image/gif;base64" ] $ DS.toUnfoldable allowedExtensions + +allowedExtensions ∷ Set String +allowedExtensions = DS.fromFoldable [ ".png", ".jpg", ".tiff", ".bmp", ".gif" ] base ∷ Int -base = 500 +base = 1000 maxImageSize ∷ Int maxImageSize = base * 1024 @@ -21,17 +26,11 @@ maxImageSize = base * 1024 maxImageSizeKB ∷ String maxImageSizeKB = show base <> " KB" -productionBasePath ∷ String -productionBasePath = "https://static.mero.chat/file/ourmelon/" - -developmentImageBasePath ∷ String -developmentImageBasePath = "/client/media/" - -developmentJsBasePath ∷ String -developmentJsBasePath = "/client/javascript/" +onlineBasePath ∷ String +onlineBasePath = "https://static.mero.chat/file/" -developmentCssBasePath ∷ String -developmentCssBasePath = "/client/css/" +localBasePath ∷ String +localBasePath = "file/" uploadFolder ∷ String uploadFolder = "upload/" @@ -39,7 +38,10 @@ uploadFolder = "upload/" bundleFolder ∷ String bundleFolder = "bundle/" -data ResourceType = Css | Js | Png | Ico | Included +defaultFolder ∷ String +defaultFolder = "default/" + +data ResourceType = Css | Js | Png | Ico | Ignore derive instance Eq ResourceType @@ -104,32 +106,25 @@ data Media bundlePath ∷ Bundle → ResourceType → String bundlePath b = resourcePath (Right b) -mediaPath ∷ Media → ResourceType → String -mediaPath b = resourcePath (Left b) - resourcePath ∷ Either Media Bundle → ResourceType → String resourcePath res tp = path <> named <> replaced <> resourceType tp where named = resourceName res replaced = DE.either (const "") (flip replacement tp) res - + isUpload = case res of + Left (Upload _) → true + _ → false + basePath + | production && not isUpload = onlineBasePath + | otherwise = localBasePath path - | production = - if tp == Js || tp == Css then - productionBasePath <> bundleFolder - else - case res of - Left (Upload _) → productionBasePath <> uploadFolder - _ → productionBasePath - | otherwise = case tp of - Js → developmentJsBasePath - Css → developmentCssBasePath - _ → case res of - Left (Upload _) → developmentImageBasePath <> uploadFolder - _ → developmentImageBasePath - -uploadedImagePath ∷ String -uploadedImagePath = (if production then productionBasePath else developmentImageBasePath) <> uploadFolder + | tp == Js || tp == Css = + basePath <> bundleFolder + | otherwise = + --pictures + case res of + Left (Upload _) → basePath <> uploadFolder + _ → basePath <> defaultFolder resourceName ∷ Either Media Bundle → String resourceName = case _ of @@ -194,7 +189,7 @@ resourceType = case _ of Css → ".css" Png → ".png" Ico → ".ico" - Included → "" + Ignore → "" replacement ∷ Bundle → ResourceType → String replacement bundle tp diff --git a/src/Shared/Spec.purs b/src/Shared/Spec.purs index 584f878a..f6bbd70f 100644 --- a/src/Shared/Spec.purs +++ b/src/Shared/Spec.purs @@ -292,7 +292,7 @@ spec ∷ } } , developmentFiles ∷ - GET "/client/<..path>" + GET "/file/<..path>" { params ∷ { path ∷ List String } , response ∷ File } diff --git a/test/Client/Im/Chat.purs b/test/Client/Im/Chat.purs index 24073913..6a1a2490 100644 --- a/test/Client/Im/Chat.purs +++ b/test/Client/Im/Chat.purs @@ -1,7 +1,6 @@ module Test.Client.Im.Chat where import Prelude -import Shared.Im.Types (MessageContent(..), MessageStatus(..)) import Client.Im.Chat as CIC import Data.Array ((!!), (:)) @@ -13,7 +12,8 @@ import Effect.Class (liftEffect) import Effect.Now as EN import Shared.DateTime (DateTimeWrapper(..)) import Shared.Im.Contact as SIC -import Shared.Options.File (maxImageSize) +import Shared.Im.Types (MessageContent(..), MessageStatus(..)) +import Shared.Resource (maxImageSize) import Shared.Unsafe ((!@)) import Shared.Unsafe as SN import Test.Client.Model (anotherImUserId, contact, historyMessage, imUser, imUserId, model, suggestion, webSocket) diff --git a/test/Client/Im/Main.purs b/test/Client/Im/Main.purs index b15aa49d..a89b4088 100644 --- a/test/Client/Im/Main.purs +++ b/test/Client/Im/Main.purs @@ -198,15 +198,15 @@ tests = do let dummyContact = contact { user = imUser, history = [ historyMessage, historyMessage ] } anotherDummyContact = dummyContact { history = [ historyMessage, historyMessage { id = 25 } ] } - { lastSentMessageID } = CIM.findLastMessages [ dummyContact, anotherDummyContact ] imUserId - TUA.equal (Just 25) lastSentMessageID + { lastSentMessageId } = CIM.findLastMessages [ dummyContact, anotherDummyContact ] imUserId + TUA.equal (Just 25) lastSentMessageId TU.test "checkMissedEvents finds last received message id" do let dummyContact = contact { user = imUser, history = [ historyMessage, historyMessage ] } anotherDummyContact = dummyContact { history = [ historyMessage { sender = anotherImUserId, id = 25 }, historyMessage { sender = anotherImUserId, id = 2 } ] } - { lastReceivedMessageID } = CIM.findLastMessages [ dummyContact, anotherDummyContact ] imUserId - TUA.equal (Just 25) lastReceivedMessageID + { lastReceivedMessageId } = CIM.findLastMessages [ dummyContact, anotherDummyContact ] imUserId + TUA.equal (Just 25) lastReceivedMessageId where getHistory contacts = do diff --git a/test/Server/Im/Action.purs b/test/Server/Im/Action.purs index 149ec277..2a2e3322 100644 --- a/test/Server/Im/Action.purs +++ b/test/Server/Im/Action.purs @@ -10,17 +10,17 @@ import Shared.Im.Types import Data.Array as DA import Data.BigInt as BI +import Data.Either (Either(..)) +import Data.Either as DE import Data.Maybe (Maybe(..)) import Data.Maybe as DM +import Data.Set as DST import Data.String as DS import Data.String.Regex as DSR import Data.String.Regex.Flags (noFlags) import Data.String.Regex.Unsafe as DSRU import Data.Tuple (Tuple(..)) -import Data.Either as DE import Run as R -import Data.Set as DST -import Shared.Privilege (Privilege(..)) import Server.Database as SD import Server.Database.Types (Checked(..)) import Server.Database.Users (_temporary, users) @@ -29,8 +29,8 @@ import Server.Im.Action as SIA import Server.Im.Database as SID import Server.Landing.Database as SLD import Server.Settings.Action as SSA -import Data.Either (Either(..)) -import Shared.Options.File (maxImageSize) +import Shared.Privilege (Privilege(..)) +import Shared.Resource (maxImageSize) import Shared.Unsafe ((!@)) import Shared.Unsafe as SU import Shared.User (ProfileVisibility(..)) diff --git a/webpack.development.config.js b/webpack.development.config.js index abeeb521..d58056b5 100644 --- a/webpack.development.config.js +++ b/webpack.development.config.js @@ -2,6 +2,9 @@ import path from 'path'; import webpack from 'webpack'; +import MiniCssExtractPlugin from 'mini-css-extract-plugin'; + + const isWatch = process.argv.some(a => a === '--watch'); export default { @@ -10,42 +13,45 @@ export default { entry: { im: { - import: ['./loader/development/im.bundle.js'], + import: ['./loader/development/im.bundle.js', './src/Client/css/im.css'], dependOn: 'emoji' }, - landing: ['./loader/development/landing.bundle.js'], + landing: ['./loader/development/landing.bundle.js', './src/Client/css/landing.css'], login: './loader/development/login.bundle.js', profile: { - import: ['./loader/development/profile.bundle.js'], + import: ['./loader/development/profile.bundle.js', './src/Client/css/profile.css'], dependOn: 'im' }, karmaPrivileges: { - import: ['./loader/development/karmaPrivileges.bundle.js'], + import: ['./loader/development/karmaPrivileges.bundle.js', './src/Client/css/karmaPrivileges.css'], dependOn: 'im' }, - help: ['./loader/development/help.bundle.js'], + help: ['./loader/development/help.bundle.js', './src/Client/css/help.css'], internalHelp: { import: ['./loader/development/internalHelp.bundle.js'], dependOn: 'im' }, settings: { - import: ['./loader/development/settings.bundle.js'], + import: ['./loader/development/settings.bundle.js', './src/Client/css/settings.css'], dependOn: 'im' }, experiments: { - import: ['./loader/development/experiments.bundle.js'], + import: ['./loader/development/experiments.bundle.js', './src/Client/css/experiments.css'], dependOn: 'im' }, feedback: { - import: ['./loader/development/feedback.bundle.js'], + import: ['./loader/development/feedback.bundle.js', './src/Client/css/feedback.css'], dependOn: 'im' }, recover: './loader/development/recover.bundle.js', - emoji: './output/Shared.Im.Emoji/index.js' + emoji: './output/Shared.Im.Emoji/index.js', + base: './src/Client/css/base.css', + external: './src/Client/css/external.css', + backer: './src/Client/css/backer.css' }, output: { - path: path.resolve(".", './dist/development'), + path: path.resolve(".", './file/bundle'), filename: '[name].bundle.js' }, @@ -61,7 +67,19 @@ export default { pscIde: true } }] - }] + }, + { + test: /\.css$/, + use: [ + MiniCssExtractPlugin.loader, + { + loader: 'css-loader', + options: { + url: false, + } + } + ] + }] }, resolve: { @@ -78,6 +96,9 @@ export default { minimize: false }, plugins: [ + new MiniCssExtractPlugin({ + filename: '[name].css', + }), new webpack.LoaderOptionsPlugin({ debug: true }) diff --git a/webpack.landing.config.js b/webpack.landing.config.js index 080d63e1..b50f9c06 100644 --- a/webpack.landing.config.js +++ b/webpack.landing.config.js @@ -15,7 +15,7 @@ export default { style: ['./src/Client/css/base.css', './src/Client/css/external.css', './src/Client/css/landing.css'] }, output: { - path: path.resolve('.', 'dist/production'), + path: path.resolve('.', 'file/bundle'), filename: '[name].[contenthash].bundle.js' }, plugins: [ @@ -25,8 +25,8 @@ export default { new webpack.DefinePlugin({ 'process.env.PRODUCTION': true }), - new ReplaceHashPlugin({ files: [{ dir: 'dist/production', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }), - new InlineStylePlugin({ files: [{styleFile: 'dist/production/style.css', htmlFile: 'output-es/Server.Landing.Template/index.js'} ]}) + new ReplaceHashPlugin({ files: [{ dir: 'file/bundle', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }), + new InlineStylePlugin({ files: [{styleFile: 'file/bundle/style.css', htmlFile: 'output-es/Server.Landing.Template/index.js'} ]}) ], module: { rules: [ diff --git a/webpack.production.config.js b/webpack.production.config.js index 0ba7630b..3234bfa5 100644 --- a/webpack.production.config.js +++ b/webpack.production.config.js @@ -45,7 +45,7 @@ export default { backer: './src/Client/css/backer.css' }, output: { - path: path.resolve(".", 'dist/production'), + path: path.resolve(".", 'file/bundle'), filename: '[name].[contenthash].bundle.js' }, plugins: [ @@ -55,7 +55,7 @@ export default { new webpack.DefinePlugin({ 'process.env.PRODUCTION': true }), - new ReplaceHashPlugin({ files: [{ dir: 'dist/production', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }), + new ReplaceHashPlugin({ files: [{ dir: 'file/bundle', prefix: 'common' }, 'output-es/Shared.Resource/index.js'] }), ], module: { rules: [