Compare commits

..
Author SHA1 Message Date
Ajay Bura a430c0dfd7 remove paragraph from markdown 2022-10-22 16:31:26 +05:30
Ajay Bura e850d48fc3 Fix #898, #897 2022-10-11 20:07:26 +05:30
16 changed files with 2070 additions and 1256 deletions

No files matched your search

+6 -6
View File
@@ -12,18 +12,18 @@ jobs:
PR_NUMBER: ${{github.event.number}}
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: Setup node
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.5.0
with:
node-version: 18.12.1
node-version: 17.9.0
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build app
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v3.1.0
with:
name: preview
path: dist
@@ -31,8 +31,8 @@ jobs:
- name: Save pr number
run: echo ${PR_NUMBER} > ./pr.txt
- name: Upload pr number
uses: actions/upload-artifact@v3.1.1
uses: actions/upload-artifact@v3.1.0
with:
name: pr
path: ./pr.txt
retention-days: 1
retention-days: 1
+4 -4
View File
@@ -13,16 +13,16 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Download pr number
uses: dawidd6/action-download-artifact@46b4ae883bf0726f5949d025d31cb62c7a5ac70c
uses: dawidd6/action-download-artifact@7847792dd435a50521b8e3bd3576dae7459d1fa8
with:
workflow: ${{ github.event.workflow.id }}
run_id: ${{ github.event.workflow_run.id }}
name: pr
- name: Output pr number
id: pr
run: echo "id=$(<pr.txt)" >> $GITHUB_OUTPUT
run: echo "::set-output name=id::$(<pr.txt)"
- name: Download artifact
uses: dawidd6/action-download-artifact@46b4ae883bf0726f5949d025d31cb62c7a5ac70c
uses: dawidd6/action-download-artifact@7847792dd435a50521b8e3bd3576dae7459d1fa8
with:
workflow: ${{ github.event.workflow.id }}
run_id: ${{ github.event.workflow_run.id }}
@@ -30,7 +30,7 @@ jobs:
path: dist
- name: Deploy to Netlify
id: netlify
uses: nwtgck/actions-netlify@ac1cb16858bada08a9c71a81240a85cfc3f72913
uses: nwtgck/actions-netlify@b7c1504e00c6b8a249d1848cc1b522a4865eed99
with:
publish-dir: dist
deploy-message: "Deploy PR ${{ steps.pr.outputs.id }}"
+2 -2
View File
@@ -11,9 +11,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: Build Docker image
uses: docker/build-push-action@v3.2.0
uses: docker/build-push-action@v3.1.1
with:
context: .
push: false
+1 -1
View File
@@ -14,7 +14,7 @@ jobs:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: NPM Lockfile Changes
uses: codepunkt/npm-lockfile-changes@b40543471c36394409466fdb277a73a0856d7891
with:
+4 -4
View File
@@ -11,18 +11,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: Setup node
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.5.0
with:
node-version: 18.12.1
node-version: 17.9.0
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build app
run: npm run build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@ac1cb16858bada08a9c71a81240a85cfc3f72913
uses: nwtgck/actions-netlify@b7c1504e00c6b8a249d1848cc1b522a4865eed99
with:
publish-dir: dist
deploy-message: "Dev deploy ${{ github.sha }}"
+11 -11
View File
@@ -10,18 +10,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: Setup node
uses: actions/setup-node@v3.5.1
uses: actions/setup-node@v3.5.0
with:
node-version: 18.12.1
node-version: 17.9.0
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build app
run: npm run build
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@ac1cb16858bada08a9c71a81240a85cfc3f72913
uses: nwtgck/actions-netlify@b7c1504e00c6b8a249d1848cc1b522a4865eed99
with:
publish-dir: dist
deploy-message: "Prod deploy ${{ github.ref_name }}"
@@ -64,31 +64,31 @@ jobs:
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3.1.0
uses: actions/checkout@v3.0.2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
uses: docker/setup-qemu-action@v2.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2.2.1
uses: docker/setup-buildx-action@v2.0.0
- name: Login to Docker Hub
uses: docker/login-action@v2.1.0
uses: docker/login-action@v2.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Login to the Container registry
uses: docker/login-action@v2.1.0
uses: docker/login-action@v2.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4.1.1
uses: docker/metadata-action@v4.0.1
with:
images: |
${{ secrets.DOCKER_USERNAME }}/cinny
ghcr.io/${{ github.repository }}
- name: Build and push Docker image
uses: docker/build-push-action@v3.2.0
uses: docker/build-push-action@v3.1.1
with:
context: .
platforms: linux/amd64,linux/arm64
+2 -2
View File
@@ -1,5 +1,5 @@
## Builder
FROM node:18.12.1-alpine3.15 as builder
FROM node:17.9.0-alpine3.15 as builder
WORKDIR /src
@@ -10,7 +10,7 @@ RUN npm run build
## App
FROM nginx:1.23.2-alpine
FROM nginx:1.23.1-alpine
COPY --from=builder /src/dist /app
+1 -1
View File
@@ -84,7 +84,7 @@ UeGsouhyuITLwEhScounZDqop+Dx
## Local development
> We recommend using a version manager as versions change very quickly. You will likely need to switch
between multiple Node.js versions based on the needs of different projects you're working on. [NVM on windows](https://github.com/coreybutler/nvm-windows#installation--upgrades) on Windows and [nvm](https://github.com/nvm-sh/nvm) on Linux/macOS are pretty good choices. Also recommended nodejs version Hydrogen LTS (v18).
between multiple Node.js versions based on the needs of different projects you're working on. [NVM on windows](https://github.com/coreybutler/nvm-windows#installation--upgrades) on Windows and [nvm](https://github.com/nvm-sh/nvm) on Linux/macOS are pretty good choices. Also recommended nodejs version is 16.15.0 LTS.
Execute the following commands to start a development server:
```sh
+1 -1
View File
@@ -1,9 +1,9 @@
{
"defaultHomeserver": 3,
"homeserverList": [
"converser.eu",
"envs.net",
"halogen.city",
"kde.org",
"matrix.org",
"mozilla.org"
],
+1979 -1188
View File
File diff suppressed because it is too large. Load diff
+20 -19
View File
@@ -4,7 +4,8 @@
"description": "Yet another matrix client",
"main": "index.js",
"engines": {
"node": ">=16.0.0"
"npm": ">=6.14.8",
"node": ">=14.15.0"
},
"scripts": {
"start": "webpack serve --config ./webpack.dev.js --open",
@@ -14,13 +15,13 @@
"author": "Ajay Bura",
"license": "MIT",
"dependencies": {
"@fontsource/inter": "4.5.14",
"@fontsource/inter": "4.5.13",
"@fontsource/roboto": "4.5.8",
"@khanacademy/simple-markdown": "0.8.5",
"@matrix-org/olm": "3.2.13",
"@khanacademy/simple-markdown": "0.8.4",
"@matrix-org/olm": "3.2.12",
"@tippyjs/react": "4.2.6",
"babel-polyfill": "6.26.0",
"blurhash": "2.0.4",
"blurhash": "2.0.3",
"browser-encrypt-attachment": "0.3.0",
"dateformat": "5.0.3",
"emojibase-data": "7.0.1",
@@ -28,52 +29,52 @@
"flux": "4.0.3",
"formik": "2.2.9",
"html-react-parser": "3.0.4",
"katex": "0.16.3",
"katex": "0.16.2",
"linkify-html": "4.0.2",
"linkifyjs": "4.0.2",
"matrix-js-sdk": "21.0.1",
"matrix-js-sdk": "20.0.2",
"prop-types": "15.8.1",
"react": "17.0.2",
"react-autosize-textarea": "7.1.0",
"react-blurhash": "0.2.0",
"react-blurhash": "0.1.3",
"react-dnd": "15.1.2",
"react-dnd-html5-backend": "15.1.3",
"react-dom": "17.0.2",
"react-google-recaptcha": "2.1.0",
"react-modal": "3.16.1",
"sanitize-html": "2.7.3",
"react-modal": "3.15.1",
"sanitize-html": "2.7.2",
"tippy.js": "6.3.7",
"twemoji": "14.0.2"
},
"devDependencies": {
"@babel/core": "7.20.2",
"@babel/preset-env": "7.20.2",
"@babel/core": "7.19.3",
"@babel/preset-env": "7.19.3",
"@babel/preset-react": "7.18.6",
"assert": "2.0.0",
"babel-loader": "9.1.0",
"babel-loader": "8.2.5",
"browserify-fs": "1.0.0",
"buffer": "6.0.3",
"clean-webpack-plugin": "4.0.0",
"copy-webpack-plugin": "11.0.0",
"crypto-browserify": "3.12.0",
"css-loader": "6.7.1",
"css-minimizer-webpack-plugin": "4.2.2",
"eslint": "8.27.0",
"css-minimizer-webpack-plugin": "4.1.0",
"eslint": "8.24.0",
"eslint-config-airbnb": "19.0.4",
"eslint-plugin-import": "2.26.0",
"eslint-plugin-jsx-a11y": "6.6.1",
"eslint-plugin-react": "7.31.10",
"eslint-plugin-react": "7.31.8",
"eslint-plugin-react-hooks": "4.6.0",
"html-loader": "4.2.0",
"html-webpack-plugin": "5.5.0",
"mini-css-extract-plugin": "2.6.1",
"path-browserify": "1.0.1",
"sass": "1.56.0",
"sass-loader": "13.1.0",
"sass": "1.55.0",
"sass-loader": "13.0.2",
"stream-browserify": "3.0.0",
"style-loader": "3.3.1",
"url": "0.11.0",
"util": "0.12.5",
"util": "0.12.4",
"webpack": "5.74.0",
"webpack-cli": "4.10.0",
"webpack-dev-server": "4.11.1",
@@ -27,7 +27,9 @@ function ImagePackUpload({ onUpload }) {
setProgress(true);
const image = await scaleDownImage(imgFile, 512, 512);
const { content_uri: url } = await mx.uploadContent(image);
const url = await mx.uploadContent(image, {
onlyContentUri: true,
});
onUpload(shortcode, url);
setProgress(false);
@@ -22,7 +22,7 @@ function ImageUpload({
const file = e.target.files.item(0);
if (file === null) return;
try {
const uPromise = initMatrix.matrixClient.uploadContent(file);
const uPromise = initMatrix.matrixClient.uploadContent(file, { onlyContentUri: false });
setUploadPromise(uPromise);
const res = await uPromise;
+10 -6
View File
@@ -236,12 +236,16 @@ async function createRoom(opts) {
});
}
if (parentId && joinRule === 'restricted') {
const caps = await mx.getCapabilities();
if (caps['m.room_versions'].available?.['9'] !== 'stable') {
throw new Error("ERROR: The server doesn't support restricted rooms");
}
if (Number(caps['m.room_versions'].default) < 9) {
options.room_version = '9';
try {
const caps = await mx.getCapabilities();
options.room_version = caps
?.['m.room_versions']
?.['org.matrix.msc3244.room_capabilities']
?.restricted
?.preferred
|| undefined;
} catch {
console.error('Can\'t find room version for restricted.');
}
options.initial_state.push({
type: 'm.room.join_rules',
+1 -1
View File
@@ -395,7 +395,7 @@ class RoomsInput extends EventEmitter {
input.attachment.uploadingPromise = uploadingPromise;
this.roomIdToInput.set(roomId, input);
const { content_uri: url } = await uploadingPromise;
const url = await uploadingPromise;
delete input.attachment.uploadingPromise;
this.roomIdToInput.set(roomId, input);
+24 -8
View File
@@ -82,12 +82,22 @@ const plainRules = {
},
newline: {
...defaultRules.newline,
match: blockRegex(/^ *\n/),
plain: () => '\n',
html: () => '<br>',
},
paragraph: {
...defaultRules.paragraph,
plain: (node, output, state) => `${output(node.content, state)}\n\n`,
html: (node, output, state) => htmlTag('p', output(node.content, state)),
match: (source, state) => {
const endMatch = blockRegex(/^([^\n]*)\n*$/);
if (endMatch) {
state.end = true;
return endMatch(source, state);
}
return blockRegex(/^([^\n]*)\n?/)(source, state);
},
plain: (node, output, state) => `${output(node.content, state)}${state.end ? '' : '\n'}`,
html: (node, output, state) => `${output(node.content, state)}${state.end ? '' : '<br>'}`,
},
escape: {
...defaultRules.escape,
@@ -101,9 +111,7 @@ const plainRules = {
text: {
...defaultRules.text,
match: anyScopeRegex(/^[\s\S]+?(?=[^0-9A-Za-z\s\u00c0-\uffff]| *\n|\w+:\S|$)/),
plain: (node, _, state) => (state.kind === 'edit'
? node.content.replace(/(\*|_|!\[|\[|\|\||\$\$?)/g, '\\$1')
: node.content),
plain: (node) => node.content,
},
};
@@ -138,7 +146,15 @@ const markdownRules = {
},
blockQuote: {
...defaultRules.blockQuote,
plain: (node, output, state) => `> ${output(node.content, state).trim().replace(/\n/g, '\n> ')}\n\n`,
match: blockRegex(/^( *>[^\n]+(\n *>+[^\n]+)*\n?)+/),
parse: (capture, parse, state) => {
const content = capture[0].replace(/^ *> ?/gm, '');
return {
content: parse(`${content}`, state),
};
},
plain: (node, output, state) => `> ${output(node.content, state).trim().replace(/\n/g, '\n> ')}\n`,
html: (node, output, state) => htmlTag('blockquote', output(node.content, state)),
},
list: {
...defaultRules.list,
@@ -492,11 +508,11 @@ function render(content, state, plainOut, htmlOut) {
};
}
const plainParser = parserFor(plainRules);
const plainParser = parserFor(plainRules, { disableAutoBlockNewlines: true });
const plainPlainOut = outputFor(plainRules, 'plain');
const plainHtmlOut = outputFor(plainRules, 'html');
const mdParser = parserFor(markdownRules);
const mdParser = parserFor(markdownRules, { disableAutoBlockNewlines: true });
const mdPlainOut = outputFor(markdownRules, 'plain');
const mdHtmlOut = outputFor(markdownRules, 'html');