Skip to content

Commit

Permalink
Latest updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfessorManhattan committed May 30, 2023
1 parent 7197200 commit c0b11cd
Show file tree
Hide file tree
Showing 15 changed files with 2,582 additions and 2,440 deletions.
4,406 changes: 2,206 additions & 2,200 deletions .firebase/hosting.d3d3.cache

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions .frontmatter/database/mediaDb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
8 changes: 8 additions & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*out
*logs
*actions
*notifications
plugins
user_trunk.yaml
user.yaml
tools
10 changes: 10 additions & 0 deletions .trunk/configs/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false
10 changes: 10 additions & 0 deletions .trunk/configs/.yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ['{|}']
empty-values:
forbid-in-block-mappings: true
forbid-in-flow-mappings: true
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
14 changes: 14 additions & 0 deletions .trunk/configs/svgo.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
plugins: [
{
name: 'preset-default',
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
};
29 changes: 29 additions & 0 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 0.1
cli:
version: 1.8.0
plugins:
sources:
- id: trunk
ref: v0.0.16
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- actionlint@1.6.24
- git-diff-check
- gitleaks@8.16.2
- markdownlint@0.33.0
- oxipng@8.0.0
- prettier@2.8.7
- svgo@3.0.2
- yamllint@1.30.0
runtimes:
enabled:
- go@1.19.5
- node@18.12.1
- python@3.10.8
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"frontMatter.framework.id": "docusaurus",
"frontMatter.content.publicFolder": "static",
"frontMatter.preview.host": "http://localhost:3000"
}
3 changes: 3 additions & 0 deletions frontmatter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://frontmatter.codes/frontmatter.schema.json"
}
11 changes: 11 additions & 0 deletions pages/blog/pfsense-jumpcloud.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Acquire certificate required for connecting JumpCloud to pfSense.

JumpCloud LDAPS Certificate (goes under Certificates tab)

```shell
echo -n | openssl s_client -connect ldap.jumpcloud.com:636 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/jumpcloud.ldap.pem
```

Certificate Authority (goes under CAs tab)

echo -n | openssl s_client -connect ldap.jumpcloud.com:636 -showcerts | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/jumpcloud.chain.pem
4 changes: 2 additions & 2 deletions src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export namespace Components {
};
}
interface CommunityPage {
"data": typeof CommunityPageData;
"data": any;
}
interface DocsSearch {
"defaults": typeof defaults;
Expand Down Expand Up @@ -411,7 +411,7 @@ declare namespace LocalJSX {
};
}
interface CommunityPage {
"data"?: typeof CommunityPageData;
"data"?: any;
}
interface DocsSearch {
"defaults"?: typeof defaults;
Expand Down
124 changes: 51 additions & 73 deletions src/components/docs-search/docs-search.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
import {
State,
Component,
ComponentInterface,
Element,
Prop,
Host,
h,
Listen,
} from '@stencil/core'
import { defaults } from 'src/store'
import Router from '../../router'
import { importResource } from '../../utils/common'
import { SiteHeader } from '../capacitor-site-header/capacitor-site-header'
import { State, Component, ComponentInterface, Element, Prop, Host, h, Listen } from '@stencil/core';
import { defaults } from 'src/store';
import Router from '../../router';
import { importResource } from '../../utils/common';
import { SiteHeader } from '../capacitor-site-header/capacitor-site-header';

declare global {
interface Window {
docsearch: (opts?: {}) => any
docsearch: (opts?: {}) => any;
}
}

Expand All @@ -24,68 +15,63 @@ declare global {
styleUrl: 'docs-search.scss',
})
export class DocsSearch implements ComponentInterface {
private siteContent: HTMLElement
private siteContent: HTMLElement;
private contentWidth = 736;
private uniqueId = Math.random().toString().replace('.', '');

@Prop() theme: SiteHeader['theme'] = 'light';
@Prop() placeholder = 'Search';
@Prop() defaults: typeof defaults
@Prop() defaults: typeof defaults;

@Element() el: HTMLElement
@Element() el: HTMLElement;
@State() input: {
el?: HTMLInputElement
isPristine: boolean
isEmpty: boolean
el?: HTMLInputElement;
isPristine: boolean;
isEmpty: boolean;
} = {
isPristine: true,
isEmpty: true,
};
isPristine: true,
isEmpty: true,
};
@State() searchStats: {
width?: string
left?: string
width?: string;
left?: string;
} = {};

componentDidLoad() {
importResource({ propertyName: 'docsearch', link: algolia }, () =>
this.setupSearch(),
)
importResource({ propertyName: 'docsearch', link: algolia }, () => this.setupSearch());

this.el.addEventListener(
'focus',
() => {
this.siteContent =
document.querySelector('section.ui-container') || document.querySelector('div.ui-container')
this.getContentStats()
this.siteContent = document.querySelector('section.ui-container') || document.querySelector('div.ui-container');
this.getContentStats();
},
true,
)
true
);
}

@Listen('resize', { target: 'window' })
getContentStats() {
requestAnimationFrame(() => {
if (!this.siteContent) return
if (!this.siteContent) return;

let left =
this.siteContent.getBoundingClientRect().left -
this.el.getBoundingClientRect().left
let width = this.siteContent.offsetWidth
let left = this.siteContent.getBoundingClientRect().left - this.el.getBoundingClientRect().left;
let width = this.siteContent.offsetWidth;

if (width > this.contentWidth) {
left -= (this.contentWidth - width) / 2
left -= (this.contentWidth - width) / 2;

this.searchStats = {
width: this.contentWidth.toString().concat('px'),
left: left.toString().concat('px'),
}
};
} else {
this.searchStats = {
width: width.toString().concat('px'),
left: left.toString().concat('px'),
}
};
}
})
});
}

setupSearch() {
Expand All @@ -97,44 +83,46 @@ export class DocsSearch implements ComponentInterface {
debug: false, // Set debug to true if you want to inspect the dropdown
queryHook: (e, t) => {
if (this.input.isPristine) {
this.input.isPristine = false
this.input.isPristine = false;

this.input.el = this.el.querySelector(
`#id-${this.uniqueId} input[name="search"]`,
) as HTMLInputElement
this.input.el = this.el.querySelector(`#id-${this.uniqueId} input[name="search"]`) as HTMLInputElement;

this.input.el.oninput = () => this.handleInput()
this.input.el.oninput = () => this.handleInput();

this.handleInput()
this.getContentStats()
this.handleInput();
this.getContentStats();
}
},
handleSelected: (_, __, suggestion) => {
const url = suggestion.url.replace(defaults.homepage, '')
this.clearSearch()
Router.push(url)
const url = suggestion.url.replace(defaults.homepage, '');
this.clearSearch();
if (url.substring(0, 5) === '/docs' || url.substring(0, 5) === '/auth' || url.substring(0, 5) === '/app/') {
window.location.pathname = url;
} else {
Router.push(url);
}
},
})
});
}

clearSearch = () => {
this.input.el.value = ''
this.input.el.value = '';
this.input = {
...this.input,
isEmpty: true,
}
};
};

handleInput() {
if (this.input.el.value === '') {
this.input = { ...this.input, isEmpty: true }
this.input = { ...this.input, isEmpty: true };
} else {
this.input = { ...this.input, isEmpty: false }
this.input = { ...this.input, isEmpty: false };
}
}

render() {
const { placeholder } = this
const { placeholder } = this;

return (
<Host
Expand All @@ -145,13 +133,7 @@ export class DocsSearch implements ComponentInterface {
}}
class={`theme--${this.theme}`}
>
<svg
class="search-icon"
width="14"
height="14"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<svg class="search-icon" width="14" height="14" fill="none" xmlns="http://www.w3.org/2000/svg">
<path
d="M13.7854 12.5947L10.6117 9.421a5.8626 5.8626 0 001.1752-3.5276C11.7869 2.6438 9.1431 0 5.8934 0 2.6438 0 0 2.6438 0 5.8934c0 3.2497 2.6438 5.8935 5.8934 5.8935a5.8626 5.8626 0 003.5276-1.1752l3.1737 3.1737a.8436.8436 0 001.1583-.0324.8436.8436 0 00.0324-1.1583zM1.6838 5.8934a4.2096 4.2096 0 114.2096 4.2096 4.2145 4.2145 0 01-4.2096-4.2096z"
fill="#B2BECD"
Expand Down Expand Up @@ -179,14 +161,10 @@ export class DocsSearch implements ComponentInterface {
icon="close"
onClick={() => this.clearSearch()}
/>
<site-backdrop
mobileOnly
visible={!this.input.isEmpty}
onClick={() => this.clearSearch()}
/>
<site-backdrop mobileOnly visible={!this.input.isEmpty} onClick={() => this.clearSearch()} />
</Host>
)
);
}
}

const algolia = `https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js`
const algolia = `https://cdn.jsdelivr.net/npm/docsearch.js@2/dist/cdn/docsearch.min.js`;
Loading

0 comments on commit c0b11cd

Please sign in to comment.