mirror of https://github.com/nextcloud/bookmarks
v2.3.2
This commit is contained in:
parent
198ab088ec
commit
3c75099744
|
@ -1,3 +1,11 @@
|
|||
## v2.3.2
|
||||
|
||||
- FIX webpack build
|
||||
- FIX: Create bookmarks in the current folder
|
||||
- FIX: Make folder icons clickable
|
||||
- FIX translations
|
||||
- NEW: translations
|
||||
|
||||
## v2.3.1
|
||||
|
||||
- FIX: Load tags on app init
|
||||
|
|
4
Makefile
4
Makefile
|
@ -7,9 +7,9 @@ source_dir=$(build_dir)/source
|
|||
sign_dir=$(build_dir)/sign
|
||||
package_name=$(app_name)
|
||||
cert_dir=$(HOME)/.nextcloud/certificates
|
||||
version+=2.3.1
|
||||
version+=2.3.2
|
||||
|
||||
all: dev-setup lint build-js-production test test-php
|
||||
all: dev-setup build-js-production test test-php
|
||||
|
||||
release: appstore create-tag
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ This app provides you with a web interface for collecting and organizing bookmar
|
|||
|
||||
Check out the third-party clients listed here: https://github.com/nextcloud/bookmarks#third-party-clients
|
||||
]]></description>
|
||||
<version>2.3.1</version>
|
||||
<version>2.3.2</version>
|
||||
<licence>agpl</licence>
|
||||
<author mail="blizzz@arthur-schiwon.de" homepage="https://www.arthur-schiwon.de">Arthur Schiwon</author>
|
||||
<author mail="mklehr@gmx.net">Marcel Klehr</author>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bookmarks",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "bookmarks",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"main": "js/index.js",
|
||||
"scripts": {
|
||||
"dev": "webpack --config webpack.dev.js",
|
||||
|
|
|
@ -9,14 +9,14 @@ export default {
|
|||
computed: {
|
||||
error() {
|
||||
return this.$store.state.error
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
error(error) {
|
||||
if (!error) return
|
||||
OC.Notification.showTemporary(error)
|
||||
this.$store.commit(mutations.SET_ERROR, null)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -31,7 +31,7 @@ Vue.directive('tooltip', Tooltip)
|
|||
const BookmarksApp = (global['Bookmarks'] = new Vue({
|
||||
el: '#bookmarks',
|
||||
store,
|
||||
render: h => h(App)
|
||||
render: h => h(App),
|
||||
}))
|
||||
|
||||
export default BookmarksApp
|
||||
|
|
|
@ -79,13 +79,13 @@ export default {
|
|||
components: {
|
||||
Actions,
|
||||
ActionButton,
|
||||
TagLine
|
||||
TagLine,
|
||||
},
|
||||
props: {
|
||||
bookmark: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return { title: this.bookmark.title, renaming: false, selected: false }
|
||||
|
@ -112,7 +112,7 @@ export default {
|
|||
},
|
||||
viewMode() {
|
||||
return this.$store.state.viewMode
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selected(val, oldVal) {
|
||||
|
@ -121,14 +121,14 @@ export default {
|
|||
} else {
|
||||
this.$store.commit(mutations.REMOVE_SELECTION_BOOKMARK, this.bookmark)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
onDelete() {
|
||||
this.$store.dispatch(actions.DELETE_BOOKMARK, {
|
||||
id: this.bookmark.id,
|
||||
folder: this.$store.state.fetchState.query.folder
|
||||
folder: this.$store.state.fetchState.query.folder,
|
||||
})
|
||||
},
|
||||
onDetails() {
|
||||
|
@ -151,8 +151,8 @@ export default {
|
|||
},
|
||||
clickSelect() {
|
||||
this.selected = !this.selected
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -42,17 +42,17 @@ export default {
|
|||
Bookmark,
|
||||
Folder,
|
||||
CreateBookmark,
|
||||
CreateFolder
|
||||
CreateFolder,
|
||||
},
|
||||
props: {
|
||||
bookmarks: {
|
||||
type: Array,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
folderChildren() {
|
||||
|
@ -73,8 +73,8 @@ export default {
|
|||
},
|
||||
viewMode() {
|
||||
return this.$store.state.viewMode
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -77,7 +77,7 @@ export default {
|
|||
props: {},
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
url: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -99,7 +99,7 @@ export default {
|
|||
},
|
||||
selection() {
|
||||
return this.$store.state.selection.bookmarks
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
|
@ -124,7 +124,7 @@ export default {
|
|||
onToggleViewMode() {
|
||||
this.$store.dispatch(actions.SET_SETTING, {
|
||||
key: 'viewMode',
|
||||
value: this.$store.state.viewMode === 'grid' ? 'list' : 'grid'
|
||||
value: this.$store.state.viewMode === 'grid' ? 'list' : 'grid',
|
||||
})
|
||||
},
|
||||
|
||||
|
@ -134,8 +134,8 @@ export default {
|
|||
},
|
||||
onBulkMove() {
|
||||
this.$store.commit(mutations.DISPLAY_MOVE_DIALOG, true)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -28,13 +28,13 @@ export default {
|
|||
components: { Actions, ActionButton },
|
||||
data() {
|
||||
return {
|
||||
url: ''
|
||||
url: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
creating() {
|
||||
return this.$store.state.loading.createBookmark
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$refs['input'].focus()
|
||||
|
@ -43,10 +43,10 @@ export default {
|
|||
submit() {
|
||||
this.$store.dispatch(actions.CREATE_BOOKMARK, {
|
||||
url: this.url,
|
||||
...(this.$route.name === 'folder' && { folders: [this.$route.params.folder] })
|
||||
...(this.$route.name === 'folder' && { folders: [this.$route.params.folder] }),
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -29,13 +29,13 @@ export default {
|
|||
components: { Actions, ActionButton },
|
||||
data() {
|
||||
return {
|
||||
title: ''
|
||||
title: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
loading() {
|
||||
return this.$store.state.loading.createFolder
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$refs['input'].focus()
|
||||
|
@ -45,10 +45,10 @@ export default {
|
|||
const parentFolder = this.$route.params.folder
|
||||
this.$store.dispatch(actions.CREATE_FOLDER, {
|
||||
parentFolder,
|
||||
title: this.title
|
||||
title: this.title,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -46,13 +46,13 @@ export default {
|
|||
name: 'Folder',
|
||||
components: {
|
||||
Actions,
|
||||
ActionButton
|
||||
ActionButton,
|
||||
},
|
||||
props: {
|
||||
folder: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return { renaming: false, title: this.folder.title }
|
||||
|
@ -60,7 +60,7 @@ export default {
|
|||
computed: {
|
||||
viewMode() {
|
||||
return this.$store.state.viewMode
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
|
@ -84,8 +84,8 @@ export default {
|
|||
this.folder.title = this.title
|
||||
this.$store.dispatch(actions.SAVE_FOLDER, this.folder.id)
|
||||
this.renaming = false
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -21,7 +21,7 @@ export default {
|
|||
name: 'MoveDialog',
|
||||
components: {
|
||||
Modal,
|
||||
TreeFolder
|
||||
TreeFolder,
|
||||
},
|
||||
computed: {
|
||||
showModal() {
|
||||
|
@ -55,7 +55,7 @@ export default {
|
|||
this.selection.bookmarks.length
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
|
@ -76,10 +76,10 @@ export default {
|
|||
)
|
||||
.map(child => ({
|
||||
...child,
|
||||
children: this.filterFolders(child.children)
|
||||
children: this.filterFolders(child.children),
|
||||
}))
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -27,11 +27,11 @@ export default {
|
|||
AppNavigationNew,
|
||||
AppNavigationItem,
|
||||
AppNavigationSettings,
|
||||
Settings
|
||||
Settings,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
editingTag: false
|
||||
editingTag: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -43,7 +43,7 @@ export default {
|
|||
text: tag.name,
|
||||
edit: {
|
||||
action: e => this.onRenameTag(tag.name, e.target.elements[0].value),
|
||||
reset: () => this.setEditingTag(tag.name, false)
|
||||
reset: () => this.setEditingTag(tag.name, false),
|
||||
},
|
||||
utils: {
|
||||
counter: tag.count,
|
||||
|
@ -51,15 +51,15 @@ export default {
|
|||
{
|
||||
icon: 'icon-rename',
|
||||
text: 'Rename',
|
||||
action: () => this.setEditingTag(tag.name, true)
|
||||
action: () => this.setEditingTag(tag.name, true),
|
||||
},
|
||||
{
|
||||
icon: 'icon-delete',
|
||||
text: 'Delete',
|
||||
action: () => this.onDeleteTag(tag.name)
|
||||
}
|
||||
]
|
||||
}
|
||||
action: () => this.onDeleteTag(tag.name),
|
||||
},
|
||||
],
|
||||
},
|
||||
}))
|
||||
},
|
||||
|
||||
|
@ -68,21 +68,21 @@ export default {
|
|||
{
|
||||
router: { name: 'home' },
|
||||
icon: 'icon-home',
|
||||
text: this.t('bookmarks', 'All Bookmarks')
|
||||
text: this.t('bookmarks', 'All Bookmarks'),
|
||||
},
|
||||
{
|
||||
router: { name: 'recent' },
|
||||
icon: 'icon-category-monitoring',
|
||||
text: this.t('bookmarks', 'Recent Bookmarks')
|
||||
text: this.t('bookmarks', 'Recent Bookmarks'),
|
||||
},
|
||||
{
|
||||
router: { name: 'untagged' },
|
||||
icon: 'icon-category-disabled',
|
||||
text: this.t('bookmarks', 'Untagged')
|
||||
text: this.t('bookmarks', 'Untagged'),
|
||||
},
|
||||
...this.tagMenu
|
||||
...this.tagMenu,
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
created() {},
|
||||
|
@ -109,7 +109,7 @@ export default {
|
|||
} else {
|
||||
this.editingTag = false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -104,7 +104,7 @@ export default {
|
|||
+ new URLSearchParams(
|
||||
Object.assign({}, this.$store.state.fetchState.query, {
|
||||
format: 'rss',
|
||||
page: -1
|
||||
page: -1,
|
||||
})
|
||||
).toString()
|
||||
)
|
||||
|
@ -115,7 +115,7 @@ export default {
|
|||
},
|
||||
sorting() {
|
||||
return this.$store.state.settings.sorting
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onImportOpen(e) {
|
||||
|
@ -132,7 +132,7 @@ export default {
|
|||
async onChangeSorting(e) {
|
||||
await this.$store.dispatch(actions.SET_SETTING, {
|
||||
key: 'sorting',
|
||||
value: e.target.value
|
||||
value: e.target.value,
|
||||
})
|
||||
await this.$store.dispatch(actions.FETCH_PAGE)
|
||||
},
|
||||
|
@ -152,8 +152,8 @@ export default {
|
|||
}
|
||||
await this.$store.dispatch(actions.DELETE_BOOKMARKS)
|
||||
this.$router.push({ name: 'home' })
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -53,7 +53,7 @@ export default {
|
|||
components: { AppSidebar, AppSidebarTab, Multiselect },
|
||||
data() {
|
||||
return {
|
||||
description: ''
|
||||
description: '',
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -75,7 +75,7 @@ export default {
|
|||
const duration = humanizeDuration(age, {
|
||||
language: OC.getLanguage().split('-')[0],
|
||||
units: ['d', 'h', 'm', 's'],
|
||||
largest: 1
|
||||
largest: 1,
|
||||
})
|
||||
return this.t('bookmarks', '{time} ago', { time: duration })
|
||||
} else {
|
||||
|
@ -87,12 +87,12 @@ export default {
|
|||
},
|
||||
allTags() {
|
||||
return this.$store.state.tags.map(tag => tag.name)
|
||||
}
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
bookmark(newBookmark) {
|
||||
this.description = newBookmark.description
|
||||
}
|
||||
},
|
||||
},
|
||||
created() {},
|
||||
methods: {
|
||||
|
@ -117,8 +117,8 @@ export default {
|
|||
await this.$store.dispatch(actions.SAVE_BOOKMARK, this.bookmark.id)
|
||||
await this.$store.dispatch(actions.LOAD_TAGS)
|
||||
}, 1000)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -12,8 +12,8 @@ export default {
|
|||
props: {
|
||||
tags: {
|
||||
type: Array,
|
||||
required: true
|
||||
}
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {}
|
||||
|
@ -22,8 +22,8 @@ export default {
|
|||
methods: {
|
||||
submit() {
|
||||
this.$emit('create-bookmark', this.url)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -30,19 +30,19 @@ export default {
|
|||
props: {
|
||||
folder: {
|
||||
type: Object,
|
||||
required: true
|
||||
required: true,
|
||||
},
|
||||
showChildrenDefault: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return { showChildren: false }
|
||||
},
|
||||
mounted() {
|
||||
this.showChildren = this.showChildrenDefault
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -83,7 +83,7 @@ const SETTINGS = [
|
|||
'previews.screenly.url',
|
||||
'previews.screenly.token',
|
||||
'privacy.enableScraping',
|
||||
'performance.maxBookmarksperAccount'
|
||||
'performance.maxBookmarksperAccount',
|
||||
]
|
||||
|
||||
export default {
|
||||
|
@ -94,7 +94,7 @@ export default {
|
|||
loading: false,
|
||||
success: false,
|
||||
error: '',
|
||||
timeout: null
|
||||
timeout: null,
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -103,7 +103,7 @@ export default {
|
|||
error(error) {
|
||||
if (!error) return
|
||||
OC.Notification.showTemporary(error)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
async created() {
|
||||
|
@ -145,7 +145,7 @@ export default {
|
|||
await new Promise((resolve, reject) =>
|
||||
OCP.AppConfig.setValue('bookmarks', setting, value, {
|
||||
success: resolve,
|
||||
error: reject
|
||||
error: reject,
|
||||
})
|
||||
)
|
||||
} catch (e) {
|
||||
|
@ -159,7 +159,7 @@ export default {
|
|||
const resDocument = await new Promise((resolve, reject) =>
|
||||
OCP.AppConfig.getValue('bookmarks', setting, null, {
|
||||
success: resolve,
|
||||
error: reject
|
||||
error: reject,
|
||||
})
|
||||
)
|
||||
if (resDocument.querySelector('status').textContent !== 'ok') {
|
||||
|
@ -173,8 +173,8 @@ export default {
|
|||
this.error = this.t('bookmarks', 'Failed to load settings')
|
||||
throw e
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -46,17 +46,17 @@ export default {
|
|||
name: 'ViewBookmarklet',
|
||||
components: {
|
||||
Content,
|
||||
Multiselect
|
||||
Multiselect,
|
||||
},
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: ''
|
||||
default: '',
|
||||
},
|
||||
url: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
|
@ -64,9 +64,9 @@ export default {
|
|||
title: this.title,
|
||||
url: this.url,
|
||||
tags: [],
|
||||
description: ''
|
||||
description: '',
|
||||
},
|
||||
exists: false
|
||||
exists: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -75,7 +75,7 @@ export default {
|
|||
},
|
||||
folders() {
|
||||
return this.$store.state.folders
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
created() {
|
||||
|
@ -122,8 +122,8 @@ export default {
|
|||
await this.$store.dispatch(actions.CREATE_BOOKMARK, this.bookmark)
|
||||
}
|
||||
window.close()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -29,11 +29,11 @@ export default {
|
|||
Breadcrumbs,
|
||||
BookmarksList,
|
||||
SidebarBookmark,
|
||||
MoveDialog
|
||||
MoveDialog,
|
||||
},
|
||||
data: function() {
|
||||
return {
|
||||
newBookmark: false
|
||||
newBookmark: false,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
@ -48,11 +48,11 @@ export default {
|
|||
},
|
||||
loading() {
|
||||
return this.$store.state.loading
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
watch: {
|
||||
$route: 'onRoute'
|
||||
$route: 'onRoute',
|
||||
},
|
||||
|
||||
async created() {
|
||||
|
@ -63,7 +63,7 @@ export default {
|
|||
await Promise.all([
|
||||
this.reloadSettings(),
|
||||
this.reloadTags(),
|
||||
this.reloadFolders()
|
||||
this.reloadFolders(),
|
||||
])
|
||||
this.onRoute()
|
||||
},
|
||||
|
@ -123,8 +123,8 @@ export default {
|
|||
) {
|
||||
this.$store.dispatch(actions.FETCH_PAGE)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
|
|
@ -33,7 +33,7 @@ const BookmarksApp = (global['Bookmarks'] = new Vue({
|
|||
el: '#content',
|
||||
store,
|
||||
router,
|
||||
render: h => h(App)
|
||||
render: h => h(App),
|
||||
}))
|
||||
|
||||
export default BookmarksApp
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
export default {
|
||||
methods: {
|
||||
t,
|
||||
n
|
||||
n,
|
||||
},
|
||||
data: () => ({
|
||||
OC,
|
||||
OCA
|
||||
})
|
||||
OCA,
|
||||
}),
|
||||
}
|
||||
|
|
|
@ -14,38 +14,38 @@ export default new Router({
|
|||
{
|
||||
path: '/',
|
||||
name: 'home',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/recent',
|
||||
name: 'recent',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/search/:search',
|
||||
name: 'search',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/folder/:folder',
|
||||
name: 'folder',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/tags/:tags',
|
||||
name: 'tags',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/untagged',
|
||||
name: 'untagged',
|
||||
component: ViewPrivate
|
||||
component: ViewPrivate,
|
||||
},
|
||||
{
|
||||
path: '/bookmarklet',
|
||||
name: 'bookmarklet',
|
||||
component: ViewBookmarklet,
|
||||
props: (route) => ({ url: route.query.url, title: route.query.title })
|
||||
}
|
||||
]
|
||||
props: (route) => ({ url: route.query.url, title: route.query.title }),
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
|
@ -40,7 +40,7 @@ export const actions = {
|
|||
|
||||
SET_SETTING: 'SET_SETTING',
|
||||
LOAD_SETTING: 'LOAD_SETTING',
|
||||
LOAD_SETTINGS: 'SLOAD_SETTINGS'
|
||||
LOAD_SETTINGS: 'SLOAD_SETTINGS',
|
||||
}
|
||||
|
||||
export default {
|
||||
|
@ -55,11 +55,11 @@ export default {
|
|||
try {
|
||||
const response = await axios.get(url('/bookmark'), {
|
||||
params: {
|
||||
url: link
|
||||
}
|
||||
url: link,
|
||||
},
|
||||
})
|
||||
const {
|
||||
data: { data: bookmarks, status }
|
||||
data: { data: bookmarks, status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -85,11 +85,11 @@ export default {
|
|||
title: data.title,
|
||||
description: data.description,
|
||||
folders: data.folders,
|
||||
tags: data.tags
|
||||
tags: data.tags,
|
||||
})
|
||||
.then(response => {
|
||||
const {
|
||||
data: { item: bookmark, status }
|
||||
data: { item: bookmark, status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data.data.join('\n'))
|
||||
|
@ -116,7 +116,7 @@ export default {
|
|||
.put(url(`/bookmark/${id}`), this.getters.getBookmark(id))
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -140,13 +140,13 @@ export default {
|
|||
) {
|
||||
commit(mutations.FETCH_START, { type: 'moveBookmark' })
|
||||
try {
|
||||
let response = await axios.post(
|
||||
const response = await axios.post(
|
||||
url(`/folder/${newFolder}/bookmarks/${bookmark}`)
|
||||
)
|
||||
if (response.data.status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
}
|
||||
let response2 = await axios.delete(
|
||||
const response2 = await axios.delete(
|
||||
url(`/folder/${oldFolder}/bookmarks/${bookmark}`)
|
||||
)
|
||||
if (response2.data.status !== 'success') {
|
||||
|
@ -202,7 +202,7 @@ export default {
|
|||
}
|
||||
},
|
||||
[actions.IMPORT_BOOKMARKS]({ commit, dispatch, state }, file) {
|
||||
var data = new FormData()
|
||||
const data = new FormData()
|
||||
data.append('bm_import', file)
|
||||
return axios
|
||||
.post(url(`/bookmark/import`), data)
|
||||
|
@ -233,7 +233,7 @@ export default {
|
|||
.delete(url(`/bookmark`))
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -254,11 +254,11 @@ export default {
|
|||
commit(mutations.FETCH_START, { type: 'tag' })
|
||||
return axios
|
||||
.put(url(`/tag/${oldName}`), {
|
||||
name: newName
|
||||
name: newName,
|
||||
})
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -302,7 +302,7 @@ export default {
|
|||
.delete(url(`/tag/${tag}`))
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -325,14 +325,14 @@ export default {
|
|||
type: 'folders',
|
||||
cancel: () => {
|
||||
canceled = true
|
||||
}
|
||||
},
|
||||
})
|
||||
return axios
|
||||
.get(url('/folder'), { params: {} })
|
||||
.then(response => {
|
||||
if (canceled) return
|
||||
const {
|
||||
data: { data, status }
|
||||
data: { data, status },
|
||||
} = response
|
||||
if (status !== 'success') throw new Error(data)
|
||||
const folders = data
|
||||
|
@ -355,7 +355,7 @@ export default {
|
|||
.delete(url(`/folder/${id}`))
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -378,11 +378,11 @@ export default {
|
|||
return axios
|
||||
.post(url(`/folder`), {
|
||||
parent_folder: parentFolder,
|
||||
title
|
||||
title,
|
||||
})
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -405,11 +405,11 @@ export default {
|
|||
return axios
|
||||
.put(url(`/folder/${id}`), {
|
||||
parent_folder: folder.parent_folder,
|
||||
title: folder.title
|
||||
title: folder.title,
|
||||
})
|
||||
.then(response => {
|
||||
const {
|
||||
data: { status }
|
||||
data: { status },
|
||||
} = response
|
||||
if (status !== 'success') {
|
||||
throw new Error(response.data)
|
||||
|
@ -443,7 +443,7 @@ export default {
|
|||
await dispatch(actions.MOVE_BOOKMARK, {
|
||||
oldFolder: bookmark.folders[bookmark.folders.length - 1], // FIXME This is veeeery ugly and will cause issues. Inevitably.
|
||||
newFolder: folderId,
|
||||
bookmark: bookmark.id
|
||||
bookmark: bookmark.id,
|
||||
})
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -517,7 +517,7 @@ export default {
|
|||
type: 'bookmarks',
|
||||
cancel() {
|
||||
canceled = true
|
||||
}
|
||||
},
|
||||
})
|
||||
axios
|
||||
.get(url('/bookmark'), {
|
||||
|
@ -525,13 +525,13 @@ export default {
|
|||
limit: BATCH_SIZE,
|
||||
page: state.fetchState.page,
|
||||
sortby: state.settings.sorting,
|
||||
...state.fetchState.query
|
||||
}
|
||||
...state.fetchState.query,
|
||||
},
|
||||
})
|
||||
.then(response => {
|
||||
if (canceled) return
|
||||
const {
|
||||
data: { data, status }
|
||||
data: { data, status },
|
||||
} = response
|
||||
if (status !== 'success') throw new Error(data)
|
||||
const bookmarks = data
|
||||
|
@ -565,7 +565,7 @@ export default {
|
|||
}
|
||||
return axios
|
||||
.post(url(`/settings/${key}`), {
|
||||
[key]: value
|
||||
[key]: value,
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
|
@ -581,7 +581,7 @@ export default {
|
|||
.get(url(`/settings/${key}`))
|
||||
.then(async response => {
|
||||
const {
|
||||
data: { [key]: value }
|
||||
data: { [key]: value },
|
||||
} = response
|
||||
await commit(mutations.SET_SETTING, { key, value })
|
||||
if (key === 'viewMode') {
|
||||
|
@ -604,7 +604,7 @@ export default {
|
|||
return Promise.all(
|
||||
['sorting', 'viewMode'].map(key => dispatch(actions.LOAD_SETTING, key))
|
||||
)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function url(url) {
|
||||
|
|
|
@ -16,7 +16,7 @@ export default new Store({
|
|||
fetchState: {
|
||||
page: 0,
|
||||
query: {},
|
||||
reachedEnd: false
|
||||
reachedEnd: false,
|
||||
},
|
||||
loading: {
|
||||
tags: false,
|
||||
|
@ -25,12 +25,12 @@ export default new Store({
|
|||
createBookmark: false,
|
||||
saveBookmark: false,
|
||||
createFolder: false,
|
||||
saveFolder: false
|
||||
saveFolder: false,
|
||||
},
|
||||
error: null,
|
||||
settings: {
|
||||
viewMode: 'list',
|
||||
sorting: 'lastmodified'
|
||||
sorting: 'lastmodified',
|
||||
},
|
||||
bookmarks: [],
|
||||
bookmarksById: {},
|
||||
|
@ -39,13 +39,13 @@ export default new Store({
|
|||
foldersById: {},
|
||||
selection: {
|
||||
folders: [],
|
||||
bookmarks: []
|
||||
bookmarks: [],
|
||||
},
|
||||
displayNewBookmark: false,
|
||||
displayNewFolder: false,
|
||||
displayMoveDialog: false,
|
||||
sidebar: null,
|
||||
viewMode: 'list'
|
||||
viewMode: 'list',
|
||||
},
|
||||
|
||||
getters: {
|
||||
|
@ -57,18 +57,18 @@ export default new Store({
|
|||
return [{ id: '-1', children: state.folders }]
|
||||
}
|
||||
return findFolder(id, state.folders)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
function findFolder(id, children) {
|
||||
if (!children || !children.length) return []
|
||||
let folders = children.filter(folder => Number(folder.id) === Number(id))
|
||||
const folders = children.filter(folder => Number(folder.id) === Number(id))
|
||||
if (folders.length) {
|
||||
return folders
|
||||
} else {
|
||||
for (let child of children) {
|
||||
let folders = findFolder(id, child.children)
|
||||
for (const child of children) {
|
||||
const folders = findFolder(id, child.children)
|
||||
if (folders.length) {
|
||||
folders.push(child)
|
||||
return folders
|
||||
|
|
|
@ -24,7 +24,7 @@ export const mutations = {
|
|||
SET_FOLDERS: 'SET_FOLDERS',
|
||||
SET_SIDEBAR: 'SET_SIDEBAR',
|
||||
SET_SETTING: 'SET_SETTING',
|
||||
SET_VIEW_MODE: 'SET_VIEW_MODE'
|
||||
SET_VIEW_MODE: 'SET_VIEW_MODE',
|
||||
}
|
||||
export default {
|
||||
[mutations.SET_VIEW_MODE](state, viewMode) {
|
||||
|
@ -132,7 +132,7 @@ export default {
|
|||
|
||||
[mutations.REACHED_END](state) {
|
||||
Vue.set(state.fetchState, 'reachedEnd', true)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function sortFolders(folders) {
|
||||
|
|
Loading…
Reference in New Issue