You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by ki...@apache.org on 2022/03/01 21:18:39 UTC
[jena] branch main updated (4c77d8a -> 4b77be6)
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a change to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git.
from 4c77d8a Merge pull request #1213 from afs/misc
new 18ce7dd JENA-2295: Disable WebSockets in the dev server. While useful, my browser was failing to connect, filling the logs with errors, making it harder to spot legit errors.
new 788e063 JENA-2295: Add a 404 page
new 4b77be6 JENA-2295: Override YASGUI method to create the share link, make it compatible with VueRouter
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
jena-fuseki2/jena-fuseki-ui/src/router/index.js | 10 +++++-
.../src/views/{Help.vue => NotFound.vue} | 33 ++++++++++-------
.../jena-fuseki-ui/src/views/dataset/Query.vue | 42 ++++++++++++++++++++++
jena-fuseki2/jena-fuseki-ui/vue.config.js | 4 ++-
4 files changed, 75 insertions(+), 14 deletions(-)
copy jena-fuseki2/jena-fuseki-ui/src/views/{Help.vue => NotFound.vue} (59%)
[jena] 03/03: JENA-2295: Override YASGUI method to create the share link, make it compatible with VueRouter
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 4b77be6ea27d715c7c92fd0ea6483d587cf78c5e
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Mar 1 18:22:21 2022 +1300
JENA-2295: Override YASGUI method to create the share link, make it compatible with VueRouter
---
jena-fuseki2/jena-fuseki-ui/src/router/index.js | 4 ++-
.../jena-fuseki-ui/src/views/dataset/Query.vue | 42 ++++++++++++++++++++++
2 files changed, 45 insertions(+), 1 deletion(-)
diff --git a/jena-fuseki2/jena-fuseki-ui/src/router/index.js b/jena-fuseki2/jena-fuseki-ui/src/router/index.js
index 2d96376..0211dfd 100644
--- a/jena-fuseki2/jena-fuseki-ui/src/router/index.js
+++ b/jena-fuseki2/jena-fuseki-ui/src/router/index.js
@@ -29,7 +29,9 @@ const routes = [
component: Home
},
{
- path: '/dataset/:datasetName/query',
+ // JENA-2295: we expand the pattern of this path with an `*` to allow for the YASGUI
+ // query parameter, e.g. /#/dataset/abc/query?query=SELECT...
+ path: '/dataset/:datasetName/query*',
name: 'DatasetQuery',
component: () => import(/* webpackChunkName: "datasetQuery" */ '../views/dataset/Query'),
props: true
diff --git a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue
index 8f3a779..fa9b11e 100644
--- a/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue
+++ b/jena-fuseki2/jena-fuseki-ui/src/views/dataset/Query.vue
@@ -118,6 +118,8 @@
import Menu from '@/components/dataset/Menu'
import Yasqe from '@triply/yasqe'
import Yasr from '@triply/yasr'
+import queryString from 'query-string'
+import Vue from 'vue'
const SELECT_TRIPLES_QUERY = `SELECT ?subject ?predicate ?object
WHERE {
@@ -212,6 +214,27 @@ export default {
resizeable: false,
requestConfig: {
endpoint: this.$fusekiService.getFusekiUrl(`/${vm.datasetName}/sparql`)
+ },
+ /**
+ * Based on YASGUI code, but modified to avoid parsing the Vue Route query
+ * hash. Note that we cannot use `document.location.hash` since it could
+ * contain the ?query=... too. Instead, we must use Vue Route path value.
+ *
+ * @param {Yasqe} yasqe
+ */
+ createShareableLink: function (yasqe) {
+ return (
+ document.location.protocol +
+ '//' +
+ document.location.host +
+ document.location.pathname +
+ document.location.search +
+ '#' +
+ vm.$route.path +
+ '?query=' +
+ // Same as YASGUI does, good idea to avoid security problems...
+ queryString.stringify(queryString.parse(yasqe.getValue()))
+ )
}
}
)
@@ -219,12 +242,26 @@ export default {
vm.yasqe.saveQuery()
vm.yasr.setResponse(response, duration)
})
+ if (this.$route.query.query !== undefined) {
+ vm.setQuery(this.$route.query.query)
+ }
this.syncYasqePrefixes()
this.loading = false
}, 300)
})
},
+ beforeRouteUpdate (from, to, next) {
+ Vue.nextTick(() => {
+ if (this.$route.query.query !== undefined) {
+ // N.B: a blank value, like query=, will clear the query editor. Not sure if
+ // desirable, but this can be easily modified later if necessary.
+ this.setQuery(this.$route.query.query)
+ }
+ })
+ next()
+ },
+
watch: {
datasetUrl: function (val, oldVal) {
this.yasqe.options.requestConfig.endpoint = this.$fusekiService.getFusekiUrl(this.datasetUrl)
@@ -243,6 +280,11 @@ export default {
methods: {
setQuery (query) {
+ // Passing this query value through queryString.stringify(.parse) creates an
+ // invalid query. Tested some XSS values with Chrome and FFox, and couldn't
+ // trigger a popup/alert by modifying the query passed, looks like YASQE does
+ // the query cleaning before displaying it.
+ // See: https://github.com/payloadbox/xss-payload-list
this.yasqe.setValue(query)
this.syncYasqePrefixes()
},
[jena] 01/03: JENA-2295: Disable WebSockets in the dev server. While useful, my browser was failing to connect, filling the logs with errors, making it harder to spot legit errors.
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 18ce7dd1fa34d39d6938c7ff8748e9d12409de9a
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Mar 1 17:35:07 2022 +1300
JENA-2295: Disable WebSockets in the dev server. While useful, my browser was failing to connect, filling the logs with errors, making it harder to spot legit errors.
---
jena-fuseki2/jena-fuseki-ui/vue.config.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/jena-fuseki2/jena-fuseki-ui/vue.config.js b/jena-fuseki2/jena-fuseki-ui/vue.config.js
index f7a44e0..3b5916c 100644
--- a/jena-fuseki2/jena-fuseki-ui/vue.config.js
+++ b/jena-fuseki2/jena-fuseki-ui/vue.config.js
@@ -62,7 +62,9 @@ module.exports = {
ws: true,
changeOrigin: true
}
- }
+ },
+ client: false,
+ webSocketServer: false
},
// Change build paths to make them Maven compatible
// see https://cli.vuejs.org/config/
[jena] 02/03: JENA-2295: Add a 404 page
Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
kinow pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git
commit 788e0634c9302c70447ba33dd396d546971221f3
Author: Bruno P. Kinoshita <ki...@apache.org>
AuthorDate: Tue Mar 1 17:35:20 2022 +1300
JENA-2295: Add a 404 page
---
jena-fuseki2/jena-fuseki-ui/src/router/index.js | 6 +++
jena-fuseki2/jena-fuseki-ui/src/views/NotFound.vue | 49 ++++++++++++++++++++++
2 files changed, 55 insertions(+)
diff --git a/jena-fuseki2/jena-fuseki-ui/src/router/index.js b/jena-fuseki2/jena-fuseki-ui/src/router/index.js
index f4b3e2f..2d96376 100644
--- a/jena-fuseki2/jena-fuseki-ui/src/router/index.js
+++ b/jena-fuseki2/jena-fuseki-ui/src/router/index.js
@@ -18,6 +18,7 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home'
+import NotFound from '@/views/NotFound'
Vue.use(VueRouter)
@@ -70,6 +71,11 @@ const routes = [
path: '/documentation',
name: 'Help',
component: () => import(/* webpackChunkName: "documentation" */ '../views/Help')
+ },
+ {
+ path: '*',
+ name: 'Not Found',
+ component: NotFound
}
]
diff --git a/jena-fuseki2/jena-fuseki-ui/src/views/NotFound.vue b/jena-fuseki2/jena-fuseki-ui/src/views/NotFound.vue
new file mode 100644
index 0000000..1093235
--- /dev/null
+++ b/jena-fuseki2/jena-fuseki-ui/src/views/NotFound.vue
@@ -0,0 +1,49 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<template>
+ <b-container fluid>
+ <b-row class="mt-2">
+ <b-col cols="12">
+ <div class="jumbotron">
+ <h1 class="display-4">404 Page Not Found</h1>
+ <p class="lead">
+ <b-btn variant="primary" href="/">
+ <FontAwesomeIcon icon="arrow-left" /> Back to Home
+ </b-btn>
+ </p>
+ </div>
+ </b-col>
+ </b-row>
+ </b-container>
+</template>
+
+<script>
+import { library } from '@fortawesome/fontawesome-svg-core'
+import { faArrowLeft } from '@fortawesome/free-solid-svg-icons'
+import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
+
+library.add(faArrowLeft)
+
+export default {
+ name: 'NotFound',
+
+ components: {
+ FontAwesomeIcon
+ }
+}
+</script>