3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Docs work

This commit is contained in:
Dragory 2019-10-25 21:45:18 +03:00
parent 6a1ec188a6
commit d9b65590d8
10 changed files with 167 additions and 91 deletions

View file

@ -1,6 +1,13 @@
<template> <template>
<div class="expandable mb-4 bg-gray-800 border border-gray-600 rounded overflow-hidden" ref="root" v-bind:class="{'shadow-xl': isOpen}"> <div class="expandable mb-4 bg-gray-800 border border-gray-600 rounded overflow-hidden"
<div role="button" class="title p-2" v-on:click="toggle"> ref="root"
v-bind:class="{ 'shadow-xl': isOpen}">
<div role="button"
class="title p-2 focus:bg-gray-700"
v-on:click="toggle"
v-on:keydown.space="$event.preventDefault()"
v-on:keyup.space="toggle"
tabindex="0">
<chevron-down class="icon" v-bind:class="{'icon-open': isOpen}" /> <chevron-down class="icon" v-bind:class="{'icon-open': isOpen}" />
<span class="title-text"><slot name="title"></slot></span> <span class="title-text"><slot name="title"></slot></span>
</div> </div>

View file

@ -1,9 +1,9 @@
<template> <template>
<pre class="codeblock" v-highlightjs><code :class="lang" v-trim-indents="trim"><slot></slot></code></pre> <pre class="codeblock" v-highlightjs><code :class="codeLang" v-trim-indents="trim"><slot></slot></code></pre>
</template> </template>
<script> <script>
export default { export default {
props: ["lang", "trim"], props: ["codeLang", "trim"],
}; };
</script> </script>

View file

@ -7,11 +7,11 @@
<ul> <ul>
<li>Prefix (i.e. what character is preceding each command)</li> <li>Prefix (i.e. what character is preceding each command)</li>
<li>Permission levels (see <router-link to="/docs/permissions">Permissions</router-link> for more info)</li> <li>Permission levels (see <router-link to="/docs/configuration/permissions">Permissions</router-link> for more info)</li>
<li>Plugin-specific configuration (see <router-link to="/docs/plugin-configuration">Plugin configuration</router-link> for more info)</li> <li>Plugin-specific configuration (see <router-link to="/docs/configuration/plugin-configuration">Plugin configuration</router-link> for more info)</li>
</ul> </ul>
<CodeBlock lang="yaml" trim="start"> <CodeBlock code-lang="yaml" trim="start">
prefix: "!" prefix: "!"
# role id: level # role id: level

View file

@ -70,16 +70,22 @@
to: '/docs/introduction', to: '/docs/introduction',
label: 'Introduction', label: 'Introduction',
}, },
],
},
{
label: 'Configuration',
items: [
{ {
to: '/docs/configuration-format', to: '/docs/configuration/configuration-format',
label: 'Configuration format', label: 'Configuration format',
}, },
{ {
to: '/docs/plugin-configuration', to: '/docs/configuration/plugin-configuration',
label: 'Plugin configuration', label: 'Plugin configuration',
}, },
{ {
to: '/docs/permissions', to: '/docs/configuration/permissions',
label: 'Permissions', label: 'Permissions',
}, },
], ],

View file

@ -14,7 +14,7 @@
<h2>Configuration</h2> <h2>Configuration</h2>
<p> <p>
All Zeppelin configuration is done through the dashboard by editing a YAML config file. By default, only the server All Zeppelin configuration is done through the dashboard by editing a YAML config file. By default, only the server
owner has access to this, but they can give other users access as they see fit. See <router-link to="/docs/configuration-format">Configuration format</router-link> for more details. owner has access to this, but they can give other users access as they see fit. See <router-link to="/docs/configuration/configuration-format">Configuration format</router-link> for more details.
</p> </p>
<h2>Plugins</h2> <h2>Plugins</h2>

View file

@ -3,7 +3,7 @@
<h1>Permissions</h1> <h1>Permissions</h1>
<p> <p>
Permissions in Zeppelin are simply values in plugin configuration that are checked when the command is used. Permissions in Zeppelin are simply values in plugin configuration that are checked when the command is used.
These values can be changed with overrides (see <router-link to="/docs/plugin-configuration">Plugin configuration</router-link> for more info) These values can be changed with overrides (see <router-link to="/docs/configuration/plugin-configuration">Plugin configuration</router-link> for more info)
and can depend on e.g. user id, role id, channel id, category id, or <strong>permission level</strong>. and can depend on e.g. user id, role id, channel id, category id, or <strong>permission level</strong>.
</p> </p>
@ -21,7 +21,7 @@
Permission levels are defined in the config in the <strong>levels</strong> section. For example: Permission levels are defined in the config in the <strong>levels</strong> section. For example:
</p> </p>
<CodeBlock lang="yaml" trim="4"> <CodeBlock code-lang="yaml">
# "role/user id": level # "role/user id": level
levels: levels:
"172949857164722176": 100 # Example admin "172949857164722176": 100 # Example admin
@ -39,7 +39,7 @@
Here's what the configuration for this would look like: Here's what the configuration for this would look like:
</p> </p>
<CodeBlock lang="yaml" trim="4"> <CodeBlock code-lang="yaml">
plugins: plugins:
cats: cats:
config: config:
@ -63,7 +63,7 @@
Here's what the configuration for this would look like: Here's what the configuration for this would look like:
</p> </p>
<CodeBlock lang="yaml" trim="4"> <CodeBlock code-lang="yaml">
plugins: plugins:
mod_actions: mod_actions:
=overrides: # The "=" here means "replace any defaults" =overrides: # The "=" here means "replace any defaults"

View file

@ -10,10 +10,10 @@
<Tabs> <Tabs>
<Tab :active="tab === 'usage'"> <Tab :active="tab === 'usage'">
<router-link v-bind:to="'/docs/plugins/' + pluginName + '/usage'">Usage</router-link> <router-link class="unstyled" v-bind:to="'/docs/plugins/' + pluginName + '/usage'">Usage</router-link>
</Tab> </Tab>
<Tab :active="tab === 'configuration'"> <Tab :active="tab === 'configuration'">
<router-link v-bind:to="'/docs/plugins/' + pluginName + '/configuration'">Configuration</router-link> <router-link class="unstyled" v-bind:to="'/docs/plugins/' + pluginName + '/configuration'">Configuration</router-link>
</Tab> </Tab>
</Tabs> </Tabs>
@ -110,14 +110,14 @@
<!-- Default configuration --> <!-- Default configuration -->
<h2 id="default-configuration">Default configuration</h2> <h2 id="default-configuration">Default configuration</h2>
<CodeBlock lang="yaml">{{ renderConfiguration(data.defaultOptions) }}</CodeBlock> <CodeBlock code-lang="yaml">{{ renderConfiguration(data.defaultOptions) }}</CodeBlock>
<!-- Config schema --> <!-- Config schema -->
<h2 id="config-schema">Config schema</h2> <h2 id="config-schema">Config schema</h2>
<Expandable class="wide"> <Expandable class="wide">
<template v-slot:title>Click to expand</template> <template v-slot:title>Click to expand</template>
<template v-slot:content> <template v-slot:content>
<CodeBlock lang="plain">{{ data.configSchema }}</CodeBlock> <CodeBlock code-lang="plain">{{ data.configSchema }}</CodeBlock>
</template> </template>
</Expandable> </Expandable>
</div> </div>

View file

@ -2,93 +2,137 @@
<div> <div>
<h1>Plugin configuration</h1> <h1>Plugin configuration</h1>
<p> <p>
Each plugin in Zeppelin has its own configuration options. In the config editor, you can both set the default config Most plugins in Zeppelin have configurable options. The values for these options come from 3 places:
and overrides based on specific conditions. Permissions are also just values in the plugin's config, and thus follow </p>
the same rules with overrides etc. as other options (see <router-link to="/docs/permissions">Permissions</router-link> for more info). <ol>
<li>
<strong>Default options</strong> (from Zeppelin)
</li>
<li>
<strong>Custom options</strong> (set by you in config)
</li>
<li>
<strong>Overrides</strong> (conditional config values, see below)
</li>
</ol>
<p>
Permissions are also just regular config options with a <code>true</code>/<code>false</code> value.
<router-link to="/docs/configuration/permissions">See the Permissions page for more info.</router-link>
</p> </p>
<p> <p>
Information about each plugin's options can be found on the plugin's page on the sidebar. See <router-link to="/docs/configuration-format">Configuration format</router-link> for an example of a full config. Information about each plugin's options can be found on the plugin's page, which can be accessed from the sidebar.
<router-link to="/docs/configuration/configuration-format">See the Configuration format page for an example of a full config.</router-link>
</p> </p>
<h2>Overrides</h2> <h2>Overrides</h2>
<p> <p>
Overrides are the primary mechanism of changing options and permissions based on permission levels, roles, channels, user ids, etc. Overrides are the primary mechanism of changing options and permissions based on permission levels, roles,
</p> channels, user ids, etc.
<p>
Here's an example demonstrating different types of overrides:
</p> </p>
<CodeBlock lang="yaml" trim="4"> <Expandable class="wide">
plugins: <template v-slot:title>Click to see examples of different types of overrides</template>
example_plugin: <template v-slot:content>
config: <CodeBlock code-lang="yaml">
can_kick: false plugins:
kick_message: "You have been kicked" example_plugin:
nested:
value: "Hello"
other_value: "Foo"
overrides:
# Simple permission level based override to allow kicking only for levels 50 and up
- level: '>=50'
config: config:
can_kick: true can_kick: false
kick_message: "You have been kicked"
nested: nested:
# This only affects nested.other_value; nested.value is still "Hello" value: "Hello"
other_value: "Bar" other_value: "Foo"
# Channel override - don't allow kicking on the specified channel overrides:
- channel: "109672661671505920" # Simple permission level based override to allow kicking only for levels 50 and up
config: - level: '>=50'
can_kick: false config:
# Same as above, but for a full category can_kick: true
- category: "360735466737369109" nested:
config: # This only affects nested.other_value; nested.value is still "Hello"
can_kick: false other_value: "Bar"
# Multiple channels. If any of them match, this override applies. # Channel override - don't allow kicking on the specified channel
- channel: ["109672661671505920", "570714864285253677"] - channel: "109672661671505920"
config: config:
can_kick: false can_kick: false
# Match based on a role # Same as above, but for a full category
- role: "172950000412655616" - category: "360735466737369109"
config: config:
can_kick: false can_kick: false
# Match based on multiple roles. The user must have ALL roles mentioned here for this override to apply. # Multiple channels. If any of them match, this override applies.
- role: ["172950000412655616", "172949857164722176"] - channel: ["109672661671505920", "570714864285253677"]
config: config:
can_kick: false can_kick: false
# Match on user id # Match based on a role
- user: "106391128718245888" - role: "172950000412655616"
config: config:
kick_message: "You have been kicked by Dragory" can_kick: false
# Match on multiple conditions # Match based on multiple roles. The user must have ALL roles mentioned here for this override to apply.
- channel: "109672661671505920" - role: ["172950000412655616", "172949857164722176"]
role: "172950000412655616" config:
config: can_kick: false
can_kick: false # Match on user id
# Match on ANY of multiple conditions - user: "106391128718245888"
- any: config:
- channel: "109672661671505920" kick_message: "You have been kicked by Dragory"
- role: "172950000412655616" # Match on multiple conditions
config:
can_kick: false
# Match on either of two complex conditions
- any:
- all:
- channel: "109672661671505920" - channel: "109672661671505920"
role: "172950000412655616" role: "172950000412655616"
- not: config:
role: "473085927053590538" can_kick: false
- channel: "534727637017559040" # Match on ANY of multiple conditions
role: "473086848831455234" - any:
config: - channel: "109672661671505920"
can_kick: false - role: "172950000412655616"
config:
can_kick: false
# Match on either of two complex conditions
- any:
- all:
- channel: "109672661671505920"
role: "172950000412655616"
- not:
role: "473085927053590538"
- channel: "534727637017559040"
role: "473086848831455234"
config:
can_kick: false
</CodeBlock>
</template>
</Expandable>
<h2>Default overrides</h2>
<p>
Many plugins have some overrides by default, usually for the default mod level (50) and/or the default admin level
(100). These are applied before any custom overrides in the config.
</p>
<p>
You can see the default overrides for each plugin by checking the <strong>Default configuration section</strong>
under the <strong>Configuration tab</strong> on the plugin's documentation page.
</p>
<p>
To replace a plugin's default overrides entirely, set <code>replaceDefaultOverrides</code> to <code>true</code> in
plugin options, on the same level as <code>config</code> and <code>overrides</code>. In the following example, any
default overrides the plugin had will no longer have an effect:
</p>
<CodeBlock code-lang="yaml">
example_plugin:
config:
can_kick: false
replaceDefaultOverrides: true # <-- Here
overrides:
- level: ">=25"
config:
can_kick: true
</CodeBlock> </CodeBlock>
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts">
import CodeBlock from "./CodeBlock.vue"; import CodeBlock from "./CodeBlock.vue";
import Expandable from "../Expandable.vue";
export default { export default {
components: { CodeBlock }, components: { CodeBlock, Expandable },
}; };
</script> </script>

View file

@ -24,15 +24,15 @@ export const router = new VueRouter({
component: () => import("./components/docs/Introduction.vue"), component: () => import("./components/docs/Introduction.vue"),
}, },
{ {
path: "configuration-format", path: "configuration/configuration-format",
component: () => import("./components/docs/ConfigurationFormat.vue"), component: () => import("./components/docs/ConfigurationFormat.vue"),
}, },
{ {
path: "permissions", path: "configuration/permissions",
component: () => import("./components/docs/Permissions.vue"), component: () => import("./components/docs/Permissions.vue"),
}, },
{ {
path: "plugin-configuration", path: "configuration/plugin-configuration",
component: () => import("./components/docs/PluginConfiguration.vue"), component: () => import("./components/docs/PluginConfiguration.vue"),
}, },
{ {

View file

@ -23,7 +23,8 @@
@apply mb-4; @apply mb-4;
} }
& a:not([class]) { & a:not([class]),
& a[class=""] {
@apply link; @apply link;
} }
@ -36,6 +37,15 @@
} }
} }
& ol:not([class]) {
@apply list-decimal;
@apply mb-4;
& li {
@apply ml-6;
}
}
& code:not([class]) { & code:not([class]) {
@apply inline-code; @apply inline-code;
} }
@ -44,3 +54,12 @@
max-width: 600px; max-width: 600px;
} }
} }
@screen xl {
.main-content {
& a:not([class]),
& a[class=""] {
white-space: nowrap;
}
}
}