mirror of https://github.com/requarks/wiki
parent
4d1ab1f193
commit
102c23ec1e
@ -0,0 +1,191 @@
|
||||
#!/bin/sh
|
||||
|
||||
# The MIT License (MIT)
|
||||
#
|
||||
# Copyright (c) 2017 Eficode Oy
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
|
||||
VERSION="2.2.3"
|
||||
|
||||
set -- "$@" -- "$TIMEOUT" "$QUIET" "$PROTOCOL" "$HOST" "$PORT" "$result"
|
||||
TIMEOUT=15
|
||||
QUIET=0
|
||||
# The protocol to make the request with, either "tcp" or "http"
|
||||
PROTOCOL="tcp"
|
||||
|
||||
echoerr() {
|
||||
if [ "$QUIET" -ne 1 ]; then printf "%s\n" "$*" 1>&2; fi
|
||||
}
|
||||
|
||||
usage() {
|
||||
exitcode="$1"
|
||||
cat << USAGE >&2
|
||||
Usage:
|
||||
$0 host:port|url [-t timeout] [-- command args]
|
||||
-q | --quiet Do not output any status messages
|
||||
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
|
||||
-v | --version Show the version of this tool
|
||||
-- COMMAND ARGS Execute command with args after the test finishes
|
||||
USAGE
|
||||
exit "$exitcode"
|
||||
}
|
||||
|
||||
wait_for() {
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
if ! command -v nc >/dev/null; then
|
||||
echoerr 'nc command is missing!'
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
http)
|
||||
if ! command -v wget >/dev/null; then
|
||||
echoerr 'wget command is missing!'
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
TIMEOUT_END=$(($(date +%s) + TIMEOUT))
|
||||
|
||||
while :; do
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
nc -w 1 -z "$HOST" "$PORT" > /dev/null 2>&1
|
||||
;;
|
||||
http)
|
||||
wget --timeout=1 -q "$HOST" -O /dev/null > /dev/null 2>&1
|
||||
;;
|
||||
*)
|
||||
echoerr "Unknown protocol '$PROTOCOL'"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
result=$?
|
||||
|
||||
if [ $result -eq 0 ] ; then
|
||||
if [ $# -gt 7 ] ; then
|
||||
for result in $(seq $(($# - 7))); do
|
||||
result=$1
|
||||
shift
|
||||
set -- "$@" "$result"
|
||||
done
|
||||
|
||||
TIMEOUT=$2 QUIET=$3 PROTOCOL=$4 HOST=$5 PORT=$6 result=$7
|
||||
shift 7
|
||||
exec "$@"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ $TIMEOUT -ne 0 -a $(date +%s) -ge $TIMEOUT_END ]; then
|
||||
echo "Operation timed out" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
while :; do
|
||||
case "$1" in
|
||||
http://*|https://*)
|
||||
HOST="$1"
|
||||
PROTOCOL="http"
|
||||
shift 1
|
||||
;;
|
||||
*:* )
|
||||
HOST=$(printf "%s\n" "$1"| cut -d : -f 1)
|
||||
PORT=$(printf "%s\n" "$1"| cut -d : -f 2)
|
||||
shift 1
|
||||
;;
|
||||
-v | --version)
|
||||
echo $VERSION
|
||||
exit
|
||||
;;
|
||||
-q | --quiet)
|
||||
QUIET=1
|
||||
shift 1
|
||||
;;
|
||||
-q-*)
|
||||
QUIET=0
|
||||
echoerr "Unknown option: $1"
|
||||
usage 1
|
||||
;;
|
||||
-q*)
|
||||
QUIET=1
|
||||
result=$1
|
||||
shift 1
|
||||
set -- -"${result#-q}" "$@"
|
||||
;;
|
||||
-t | --timeout)
|
||||
TIMEOUT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-t*)
|
||||
TIMEOUT="${1#-t}"
|
||||
shift 1
|
||||
;;
|
||||
--timeout=*)
|
||||
TIMEOUT="${1#*=}"
|
||||
shift 1
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
--help)
|
||||
usage 0
|
||||
;;
|
||||
-*)
|
||||
QUIET=0
|
||||
echoerr "Unknown option: $1"
|
||||
usage 1
|
||||
;;
|
||||
*)
|
||||
QUIET=0
|
||||
echoerr "Unknown argument: $1"
|
||||
usage 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if ! [ "$TIMEOUT" -ge 0 ] 2>/dev/null; then
|
||||
echoerr "Error: invalid timeout '$TIMEOUT'"
|
||||
usage 3
|
||||
fi
|
||||
|
||||
case "$PROTOCOL" in
|
||||
tcp)
|
||||
if [ "$HOST" = "" ] || [ "$PORT" = "" ]; then
|
||||
echoerr "Error: you need to provide a host and port to test."
|
||||
usage 2
|
||||
fi
|
||||
;;
|
||||
http)
|
||||
if [ "$HOST" = "" ]; then
|
||||
echoerr "Error: you need to provide a host to test."
|
||||
usage 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
wait_for "$@"
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"upload": {
|
||||
"folder": "server/locales",
|
||||
"files": "en.json",
|
||||
"type": "json"
|
||||
},
|
||||
|
||||
"download": {
|
||||
"folder": "server/locales",
|
||||
"files": "${lang}.json",
|
||||
"metadataFileJs": "metadata.mjs"
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
[
|
||||
{
|
||||
"code": "en",
|
||||
"name": "English",
|
||||
"nativeName": "English",
|
||||
"rtl": false,
|
||||
"completeness": 100
|
||||
}
|
||||
]
|
@ -0,0 +1,31 @@
|
||||
const localazyMetadata = {
|
||||
projectUrl: "https://localazy.com/p/wiki",
|
||||
baseLocale: "en",
|
||||
languages: [
|
||||
{
|
||||
language: "en",
|
||||
region: "",
|
||||
script: "",
|
||||
isRtl: false,
|
||||
name: "English",
|
||||
localizedName: "English",
|
||||
pluralType: (n) => { return (n===1) ? "one" : "other"; }
|
||||
}
|
||||
],
|
||||
files: [
|
||||
{
|
||||
cdnHash: "54b977214afbffe2ffeb07d0ccb03558e75e4408",
|
||||
file: "file.json",
|
||||
path: "",
|
||||
library: "",
|
||||
module: "",
|
||||
buildType: "",
|
||||
productFlavors: [],
|
||||
cdnFiles: {
|
||||
"en#": "https://delivery.localazy.com/_a7797965569058078203416ae5aa/_e0/54b977214afbffe2ffeb07d0ccb03558e75e4408/en/file.json"
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
export default localazyMetadata;
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,196 @@
|
||||
<template lang="pug">
|
||||
q-layout(view='hHh lpR fFf', container)
|
||||
q-header.card-header.q-px-md.q-py-sm
|
||||
q-icon(name='img:/_assets/icons/ultraviolet-markdown.svg', left, size='md')
|
||||
span {{t('editor.settings.markdown')}}
|
||||
q-space
|
||||
q-btn.q-mr-sm(
|
||||
flat
|
||||
rounded
|
||||
color='white'
|
||||
:aria-label='t(`common.actions.refresh`)'
|
||||
icon='las la-question-circle'
|
||||
:href='siteStore.docsBase + `/editor/markdown`'
|
||||
target='_blank'
|
||||
type='a'
|
||||
)
|
||||
q-btn-group(push)
|
||||
q-btn(
|
||||
push
|
||||
color='grey-6'
|
||||
text-color='white'
|
||||
:aria-label='t(`common.actions.refresh`)'
|
||||
icon='las la-redo-alt'
|
||||
@click='load'
|
||||
:loading='state.loading > 0'
|
||||
)
|
||||
q-tooltip(anchor='center left', self='center right') {{t(`common.actions.refresh`)}}
|
||||
q-btn(
|
||||
push
|
||||
color='white'
|
||||
text-color='grey-7'
|
||||
:label='t(`common.actions.cancel`)'
|
||||
:aria-label='t(`common.actions.cancel`)'
|
||||
icon='las la-times'
|
||||
@click='close'
|
||||
)
|
||||
q-btn(
|
||||
push
|
||||
color='positive'
|
||||
text-color='white'
|
||||
:label='t(`common.actions.apply`)'
|
||||
:aria-label='t(`common.actions.apply`)'
|
||||
icon='las la-check'
|
||||
@click='save'
|
||||
:disabled='state.loading > 0'
|
||||
)
|
||||
q-page-container
|
||||
q-page.q-pa-md(style='max-width: 1200px; margin: 0 auto;')
|
||||
q-card.shadow-1.q-py-sm
|
||||
q-item(tag='label')
|
||||
blueprint-icon(icon='enter-key')
|
||||
q-item-section
|
||||
q-item-label {{t(`editor.settings.previewShown`)}}
|
||||
q-item-label(caption) {{t(`editor.settings.previewShownHint`)}}
|
||||
q-item-section(avatar)
|
||||
q-toggle(
|
||||
v-model='state.config.previewShown'
|
||||
color='primary'
|
||||
checked-icon='las la-check'
|
||||
unchecked-icon='las la-times'
|
||||
:aria-label='t(`editor.settings.previewShown`)'
|
||||
)
|
||||
q-separator.q-my-sm(inset)
|
||||
q-item
|
||||
blueprint-icon(icon='width')
|
||||
q-item-section
|
||||
q-item-label {{t(`editor.settings.fontSize`)}}
|
||||
q-item-label(caption) {{t(`editor.settings.fontSizeHint`)}}
|
||||
q-item-section(side)
|
||||
q-input(
|
||||
type='number'
|
||||
min='10'
|
||||
max='32'
|
||||
style='width: 100px;'
|
||||
outlined
|
||||
v-model='state.config.fontSize'
|
||||
dense
|
||||
:aria-label='t(`editor.settings.fontSize`)'
|
||||
)
|
||||
|
||||
q-inner-loading(:showing='state.loading > 0')
|
||||
q-spinner(color='accent', size='lg')
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useQuasar } from 'quasar'
|
||||
import { onMounted, reactive } from 'vue'
|
||||
import gql from 'graphql-tag'
|
||||
import { cloneDeep } from 'lodash-es'
|
||||
|
||||
import { useEditorStore } from 'src/stores/editor'
|
||||
import { useSiteStore } from 'src/stores/site'
|
||||
import { useUserStore } from 'src/stores/user'
|
||||
|
||||
// QUASAR
|
||||
|
||||
const $q = useQuasar()
|
||||
|
||||
// STORES
|
||||
|
||||
const editorStore = useEditorStore()
|
||||
const siteStore = useSiteStore()
|
||||
const userStore = useUserStore()
|
||||
|
||||
// I18N
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
// DATA
|
||||
|
||||
const state = reactive({
|
||||
config: {
|
||||
previewShown: false,
|
||||
fontSize: 16
|
||||
},
|
||||
loading: 0
|
||||
})
|
||||
|
||||
// METHODS
|
||||
|
||||
function close () {
|
||||
siteStore.$patch({ overlay: '' })
|
||||
}
|
||||
|
||||
async function load () {
|
||||
state.loading++
|
||||
$q.loading.show()
|
||||
try {
|
||||
const resp = await APOLLO_CLIENT.query({
|
||||
query: gql`
|
||||
query loadEditorUserSettings (
|
||||
$editor: String!
|
||||
) {
|
||||
editorUserSettings (editor: "markdown")
|
||||
}`,
|
||||
fetchPolicy: 'network-only'
|
||||
})
|
||||
state.config = cloneDeep(resp?.data?.editorUserSettings)
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'Failed to fetch Markdown editor settings.'
|
||||
})
|
||||
}
|
||||
$q.loading.hide()
|
||||
state.loading--
|
||||
}
|
||||
|
||||
async function save () {
|
||||
state.loading++
|
||||
try {
|
||||
const respRaw = await APOLLO_CLIENT.mutate({
|
||||
mutation: gql`
|
||||
mutation saveEditorUserSettings (
|
||||
$config: JSON!
|
||||
) {
|
||||
saveEditorUserSettings (
|
||||
editor: "markdown"
|
||||
config: $config
|
||||
) {
|
||||
operation {
|
||||
succeeded
|
||||
slug
|
||||
message
|
||||
}
|
||||
}
|
||||
}
|
||||
`,
|
||||
variables: {
|
||||
config: state.config
|
||||
}
|
||||
})
|
||||
if (respRaw?.data?.saveEditorUserSettings?.operation?.succeeded) {
|
||||
$q.notify({
|
||||
type: 'positive',
|
||||
message: t('admin.editors.markdown.saveSuccess')
|
||||
})
|
||||
close()
|
||||
} else {
|
||||
throw new Error(respRaw?.data?.saveEditorUserSettings?.operation?.message || 'An unexpected error occured.')
|
||||
}
|
||||
} catch (err) {
|
||||
$q.notify({
|
||||
type: 'negative',
|
||||
message: 'Failed to save Markdown editor settings.',
|
||||
caption: err.message
|
||||
})
|
||||
}
|
||||
state.loading--
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
load()
|
||||
})
|
||||
</script>
|
@ -1,5 +0,0 @@
|
||||
import en from './locales/en.json'
|
||||
|
||||
export default {
|
||||
'en-US': en
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue