Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"bugs": "https://github.com/nextcloud/tasks/issues",
"contributors": [],
"dependencies": {
"@nextcloud/auth": "^2.4.0",
Copy link
Member Author

@jaylinski jaylinski Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a direct dependency of @nextcloud/axios but not used directly in the code (via import).

"@nextcloud/axios": "^2.5.1",
"@nextcloud/calendar-js": "8.1.1",
"@nextcloud/cdav-library": "1.5.3",
Expand All @@ -43,14 +42,11 @@
"color-convert": "^3.0.1",
"debounce": "^2.2.0",
"ical.js": "^2.1.0",
"linkify-it": "^5.0.0",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a direct dependency of markdown-it.

"markdown-it": "^14.1.0",
"markdown-it-emoji": "^3.0.0",
"markdown-it-link-attributes": "^4.0.1",
"markdown-it-task-lists": "^2.1.1",
"p-limit": "^6.2.0",
"sortablejs-vue3": "^1.2.11",
"uuid": "^11.1.0",
"vue": "^3.5.13",
"vue-material-design-icons": "^5.3.1",
"vue-router": "^4.5.0",
Expand Down
4 changes: 2 additions & 2 deletions src/models/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@

import moment from '@nextcloud/moment'

import { v4 as uuid } from 'uuid'
import ICAL from 'ical.js'
import { randomUUID } from '../utils/crypto.js'

export default class Task {

Expand Down Expand Up @@ -83,7 +83,7 @@ export default class Task {

if (!this.vtodo.hasProperty('uid')) {
console.debug('This task did not have a proper uid. Setting a new one for ', this)
this.vtodo.addPropertyWithValue('uid', uuid())
this.vtodo.addPropertyWithValue('uid', randomUUID())
}

// Define components
Expand Down
58 changes: 58 additions & 0 deletions src/utils/crypto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/**
* Nextcloud - Tasks
*
* @copyright Copyright (c) 2019 Georg Ehrke
*
* @author Georg Ehrke <oc.list@georgehrke.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

/**
* Generates a random UUID v4.
*
* @return {string}
*/
export function randomUUID() {
if (crypto?.randomUUID) {
// Only available in secure contexts
return crypto.randomUUID()
}

return insecureUuidV4()
}

/**
* Generates a random UUID v4 from a weak, non-cryptographic random number generator.
* Please use randomUUID() instead.
*
* Adapted from https://gist.github.com/scwood/3bff42cc005cc20ab7ec98f0d8e1d59d
* Copyright 2018 Spencer Wood
*
* @return {string}
*/
function insecureUuidV4() {
const uuid = new Array(36)
for (let i = 0; i < 36; i++) {
uuid[i] = Math.floor(Math.random() * 16)
}
uuid[14] = 4 // set bits 12-15 of time-high-and-version to 0100
uuid[19] = uuid[19] &= ~(1 << 2) // set bit 6 of clock-seq-and-reserved to zero
uuid[19] = uuid[19] |= (1 << 3) // set bit 7 of clock-seq-and-reserved to one
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-'
return uuid.map((x) => x.toString(16)).join('')
}
Loading