-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into @Skalakid/web-parser-refactor
- Loading branch information
Showing
11 changed files
with
193 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,9 +17,12 @@ jobs: | |
if: ${{ github.actor != 'OSBotify' }} | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: main | ||
# The OS_BOTIFY_COMMIT_TOKEN is a personal access token tied to osbotify | ||
# This is a workaround to allow pushes to a protected branch | ||
token: ${{ secrets.OS_BOTIFY_COMMIT_TOKEN }} | ||
|
||
- name: Decrypt & Import OSBotify GPG key | ||
run: | | ||
|
@@ -36,17 +39,11 @@ jobs: | |
git config --global user.name OSBotify | ||
git config --global user.email [email protected] | ||
- uses: actions/setup-node@v3 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '16.x' | ||
node-version-file: '.nvmrc' | ||
registry-url: 'https://registry.npmjs.org' | ||
|
||
- name: Generate branch name | ||
run: echo "BRANCH_NAME=OSBotify-bump-version-$(uuidgen)" >> $GITHUB_ENV | ||
|
||
- name: Create branch for version-bump pull request | ||
run: git checkout -b ${{ env.BRANCH_NAME }} | ||
|
||
- name: Install yarn packages | ||
run: yarn install --immutable | ||
|
||
|
@@ -63,26 +60,7 @@ jobs: | |
run: git tag ${{ env.NEW_VERSION }} | ||
|
||
- name: Push branch and publish tags | ||
run: git push --set-upstream origin ${{ env.BRANCH_NAME }} && git push --tags | ||
|
||
- name: Create pull request | ||
run: | | ||
gh pr create \ | ||
--title "Update version to ${{ env.NEW_VERSION }}" \ | ||
--body "Update version to ${{ env.NEW_VERSION }}" | ||
sleep 5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }} | ||
|
||
- name: Auto-approve pull request | ||
run: gh pr review --approve ${{ env.BRANCH_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Auto-merge pull request | ||
run: gh pr merge --squash --delete-branch ${{ env.BRANCH_NAME }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: git push --set-upstream origin main && git push --tags | ||
|
||
- name: Build package | ||
run: yarn pack | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,6 +107,13 @@ test('labeled link', () => { | |
{type: 'link', start: 7, length: 19}, | ||
{type: 'syntax', start: 26, length: 1}, | ||
]); | ||
|
||
expect('[ Link ](https://example.com)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 7, length: 2}, | ||
{type: 'link', start: 9, length: 19}, | ||
{type: 'syntax', start: 28, length: 1}, | ||
]); | ||
}); | ||
|
||
test('link with same label as href', () => { | ||
|
@@ -177,6 +184,15 @@ describe('email with same label as address', () => { | |
}); | ||
}); | ||
|
||
test('email with multiline hyperlinks', () => { | ||
expect('[test\ntest]([email protected])').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 10, length: 2}, | ||
{type: 'link', start: 12, length: 13}, | ||
{type: 'syntax', start: 25, length: 1}, | ||
]); | ||
}); | ||
|
||
test('inline code', () => { | ||
expect('Hello `world`!').toBeParsedAs([ | ||
{type: 'syntax', start: 6, length: 1}, | ||
|
@@ -541,3 +557,86 @@ describe('report mentions', () => { | |
expect('reported #report-name!').toBeParsedAs([{type: 'mention-report', start: 9, length: 12}]); | ||
}); | ||
}); | ||
|
||
describe('inline video', () => { | ||
test('with alt text', () => { | ||
expect('![test](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 6, length: 1}, | ||
{type: 'syntax', start: 7, length: 1}, | ||
{type: 'link', start: 8, length: 29}, | ||
{type: 'syntax', start: 37, length: 1}, | ||
]); | ||
}); | ||
|
||
test('without alt text', () => { | ||
expect('![](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 2, length: 1}, | ||
{type: 'syntax', start: 3, length: 1}, | ||
{type: 'link', start: 4, length: 29}, | ||
{type: 'syntax', start: 33, length: 1}, | ||
]); | ||
}); | ||
|
||
test('with same alt text as src', () => { | ||
expect('![https://example.com/video.mp4](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 31, length: 1}, | ||
{type: 'syntax', start: 32, length: 1}, | ||
{type: 'link', start: 33, length: 29}, | ||
{type: 'syntax', start: 62, length: 1}, | ||
]); | ||
}); | ||
|
||
test('with alt text containing markdown', () => { | ||
expect('![# fake-heading *bold* _italic_ ~strike~ [:-)]](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 47, length: 1}, | ||
{type: 'syntax', start: 48, length: 1}, | ||
{type: 'link', start: 49, length: 29}, | ||
{type: 'syntax', start: 78, length: 1}, | ||
]); | ||
}); | ||
|
||
test('trying to pass additional attributes', () => { | ||
expect('![test](https://example.com/video.mp4 "title" class="video")').toBeParsedAs([{type: 'link', start: 8, length: 29}]); | ||
}); | ||
|
||
test('trying to inject additional attributes', () => { | ||
expect('![test" onerror="alert(\'xss\')](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 29, length: 1}, | ||
{type: 'syntax', start: 30, length: 1}, | ||
{type: 'link', start: 31, length: 29}, | ||
{type: 'syntax', start: 60, length: 1}, | ||
]); | ||
}); | ||
|
||
test('inline code in alt', () => { | ||
expect('![`code`](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 8, length: 1}, | ||
{type: 'syntax', start: 9, length: 1}, | ||
{type: 'link', start: 10, length: 29}, | ||
{type: 'syntax', start: 39, length: 1}, | ||
]); | ||
}); | ||
|
||
test('blockquote in alt', () => { | ||
expect('![```test```](https://example.com/video.mp4)').toBeParsedAs([ | ||
{type: 'syntax', start: 0, length: 1}, | ||
{type: 'syntax', start: 1, length: 1}, | ||
{type: 'syntax', start: 12, length: 1}, | ||
{type: 'syntax', start: 13, length: 1}, | ||
{type: 'link', start: 14, length: 29}, | ||
{type: 'syntax', start: 43, length: 1}, | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,6 @@ | |
"typescript": "^5.3.3" | ||
}, | ||
"dependencies": { | ||
"expensify-common": "2.0.35" | ||
"expensify-common": "2.0.72" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.