-
Notifications
You must be signed in to change notification settings - Fork 33
feat: Public sharing via link #2236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
67d1e55
enh(Sharing): backend infrastructre for read-only link shares
blizzz 334aea0
fixup! enh(Sharing): backend infrastructre for read-only link shares
blizzz 8f4ffb2
enh(Sharing): backend infrastructre for read-only link shares
blizzz c76da31
feat: Public sharing via link
enjeck 0cd3e20
tests(Cypress): add public link share
enjeck be0f007
enh: Rename component
enjeck 033dc79
fix: Improve UI
enjeck 20012d4
fix: Move error styles
enjeck 391084a
enh: Use emoji, title, description
enjeck d394c78
tests(Cypress): Password protected shares
enjeck 94350d0
fix: check for null token
enjeck 88fcf06
fix: Use window origin for share link
enjeck fd22bff
fix: Remove unneccesary code
enjeck bf746d4
fix: Remove TablesPublicNode from response defs
enjeck 57d3e44
fix: Add copyright header
enjeck 32731ea
fix: run lint and psalm
enjeck File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /** | ||
| * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| .tables-error-wrapper { | ||
| display: flex; | ||
| justify-content: center; | ||
| align-items: center; | ||
| width: 100%; | ||
| } | ||
|
|
||
| .body-public-container { | ||
| --color-text-maxcontrast: var( | ||
| --color-text-maxcontrast-background-blur, | ||
| var(--color-main-text) | ||
| ); | ||
| color: var(--color-main-text); | ||
| background-color: var(--color-main-background-blur); | ||
| padding: calc(3 * var(--default-grid-baseline)); | ||
| box-shadow: 0 0 10px var(--color-box-shadow); | ||
| -webkit-backdrop-filter: var(--filter-background-blur); | ||
| backdrop-filter: var(--filter-background-blur); | ||
| display: flex; | ||
| flex-direction: column; | ||
| text-align: start; | ||
| word-wrap: break-word; | ||
| border-radius: 10px; | ||
| cursor: default; | ||
| -moz-user-select: text; | ||
| -webkit-user-select: text; | ||
| -ms-user-select: text; | ||
| user-select: text; | ||
| height: fit-content; | ||
| width: 100%; | ||
| max-width: 700px; | ||
| margin-block: 10vh auto; | ||
| } | ||
|
|
||
| .body-public-container .icon-big { | ||
| background-size: 70px; | ||
| height: 70px; | ||
| } | ||
|
|
||
| .body-public-container form { | ||
| width: initial; | ||
| } | ||
|
|
||
| .body-public-container p:not(:last-child) { | ||
| margin-bottom: 12px; | ||
| } | ||
|
|
||
| .infogroup { | ||
| margin: 8px 0; | ||
| } | ||
|
|
||
| .infogroup:last-child { | ||
| margin-bottom: 0; | ||
| } | ||
|
|
||
| .update { | ||
| width: calc(100% - 32px); | ||
| text-align: center; | ||
| } |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| /** | ||
| * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
|
|
||
| describe('Public link sharing', () => { | ||
| let localUser | ||
| const tableTitle = 'Public Share Test Table' | ||
|
|
||
| before(() => { | ||
| cy.createRandomUser().then(user => { | ||
| localUser = user | ||
| cy.login(localUser) | ||
| }) | ||
| }) | ||
|
|
||
| beforeEach(() => { | ||
| cy.login(localUser) | ||
| cy.visit('apps/tables') | ||
| cy.get('[data-cy="navigationCreateTableIcon"]').click({ force: true }) | ||
| cy.get('.modal__content input[type="text"]').clear().type(tableTitle) | ||
| cy.get('.tile').contains('ToDo').click({ force: true }) | ||
| cy.get('[data-cy="createTableSubmitBtn"]').scrollIntoView().click() | ||
| cy.loadTable(tableTitle) | ||
| }) | ||
|
|
||
| it('Create, access and delete a public link share', () => { | ||
|
|
||
| cy.get('[data-cy="customTableAction"] button').click() | ||
| cy.get('[data-cy="dataTableShareBtn"]').click() | ||
| cy.contains('Public links').should('be.visible') | ||
| cy.intercept('POST', '**/apps/tables/api/2/tables/*/share').as('createShare') | ||
| cy.get('[data-cy="sharingEntryLinkCreateButton"]').click() | ||
| cy.get('[data-cy="sharingEntryLinkCreateFormCreateButton"]').click() | ||
|
|
||
| cy.wait('@createShare').then((interception) => { | ||
| expect(interception.response.statusCode).to.eq(200) | ||
| const shareToken = interception.response.body.ocs.data.shareToken | ||
| expect(shareToken).to.be.a('string') | ||
|
|
||
| cy.clearCookies() | ||
| cy.visit(`apps/tables/s/${shareToken}`) | ||
| cy.get('[data-cy="publicTableElement"]').should('be.visible') | ||
| cy.clickOnTableThreeDotMenu('Export as CSV') | ||
|
|
||
| // Verify we cannot edit (simple check: no edit controls or just read-only mode) | ||
| // We can check that the "Add row" button is missing. | ||
| cy.get('[data-cy="addRowBtn"]').should('not.exist') | ||
|
|
||
| // Login again to delete share | ||
| cy.login(localUser) | ||
| cy.visit('apps/tables') | ||
| cy.loadTable(tableTitle) | ||
|
|
||
| cy.get('[data-cy="customTableAction"] button').click() | ||
| cy.get('[data-cy="dataTableShareBtn"]').click() | ||
|
|
||
| cy.get('[data-cy="sharingEntryLinkTitle"]').should('be.visible') | ||
| cy.get('[data-cy="sharingEntryLinkDeleteButton"]').click() | ||
|
|
||
| cy.get('[data-cy="sharingEntryLinkTitle"]').should('not.exist') | ||
|
|
||
| // Verify share is gone | ||
| cy.clearCookies() | ||
| cy.visit(`apps/tables/s/${shareToken}`, { failOnStatusCode: false }) | ||
| cy.get('h2').contains('Share not found').should('be.visible') | ||
| }) | ||
| }) | ||
|
|
||
| it('Create, access and delete a password protected public link share', () => { | ||
| const password = 'extremelySafePassword123' | ||
|
|
||
| cy.get('[data-cy="customTableAction"] button').click() | ||
| cy.get('[data-cy="dataTableShareBtn"]').click() | ||
| cy.contains('Public links').should('be.visible') | ||
| cy.intercept('POST', '**/apps/tables/api/2/tables/*/share').as('createShare') | ||
|
|
||
| // Open create form | ||
| cy.get('[data-cy="sharingEntryLinkCreateButton"]').click() | ||
|
|
||
| // Set password | ||
| cy.get('[data-cy="sharingEntryLinkPasswordCheck"]').click() | ||
| cy.get('[data-cy="sharingEntryLinkPasswordInput"] input').type(password) | ||
|
|
||
| // Create | ||
| cy.get('[data-cy="sharingEntryLinkCreateFormCreateButton"]').click() | ||
|
|
||
| cy.wait('@createShare').then((interception) => { | ||
| expect(interception.response.statusCode).to.eq(200) | ||
| const shareToken = interception.response.body.ocs.data.shareToken | ||
| expect(shareToken).to.be.a('string') | ||
|
|
||
| cy.clearCookies() | ||
| cy.visit(`apps/tables/s/${shareToken}`) | ||
|
|
||
| // Password Gate | ||
| cy.get('input[type="password"]#password').should('be.visible').type(password) | ||
| cy.get('input#password-submit').click() | ||
| cy.get('[data-cy="publicTableElement"]').should('be.visible') | ||
|
|
||
| // Login again to delete share | ||
| cy.login(localUser) | ||
| cy.visit('apps/tables') | ||
| cy.loadTable(tableTitle) | ||
|
|
||
| cy.get('[data-cy="customTableAction"] button').click() | ||
| cy.get('[data-cy="dataTableShareBtn"]').click() | ||
|
|
||
| cy.get('[data-cy="sharingEntryLinkTitle"]').should('be.visible') | ||
| cy.get('[data-cy="sharingEntryLinkDeleteButton"]').click() | ||
|
|
||
| cy.get('[data-cy="sharingEntryLinkTitle"]').should('not.exist') | ||
|
|
||
| // Verify share is gone | ||
| cy.clearCookies() | ||
| cy.visit(`apps/tables/s/${shareToken}`, { failOnStatusCode: false }) | ||
| cy.get('h2').contains('Share not found').should('be.visible') | ||
| }) | ||
| }) | ||
| }) | ||
|
|
This file contains hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think all the changes in this file are not necessary?