diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..0fb68f2 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,6 @@ +My name is Rodney. I am a keen developer interested in security and online +privacy. I also love building accessible JAMStack and full stack sites. I am +equally keen to hear your suggestions for improving this project. Thanks for +your interest in the project. Could I ask you to take a look at the project's +Code of Conduct before continuing with your contribution? Thanks! A good +starting point for getting up-to-speed on the project is the README file. diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..9c574dd --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,36 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' +--- + +**Describe the bug** A clear and concise description of what the bug is. + +**To Reproduce** Steps to reproduce the behaviour: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behaviour** A clear and concise description of what you expected to +happen. + +**Screenshots** If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + +- OS: [e.g. iOS] +- Browser [e.g. chrome, safari] +- Version [e.g. 22] + +**Smartphone (please complete the following information):** + +- Device: [e.g. iPhone6] +- OS: [e.g. iOS8.1] +- Browser [e.g. stock browser, safari] +- Version [e.g. 22] + +**Additional context** Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..2866f79 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** A clear and +concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** A clear and concise description of what you +want to happen. + +**Describe alternatives you've considered** A clear and concise description of +any alternative solutions or features you've considered. + +**Additional context** Add any other context or screenshots about the feature +request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..8748ce5 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,45 @@ +# Description + +Please include a summary of the change and which issue is fixed. Please also +include relevant motivation and context. List any dependencies that are required +for this change. + +Fixes # (issue) + +## Type of change + +Please delete options that are not relevant. + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to + not work as expected) +- [ ] This change requires a documentation update +- [ ] Dependency update + +# How Has This Been Tested? + +Please describe the tests that you ran to verify your changes. Provide +instructions so we can reproduce. Please also list any relevant details for your +test configuration + +- [ ] Test A +- [ ] Test B + +**Test Configuration**: + +- Firmware version: +- Hardware: +- Toolchain: +- SDK: + +# Checklist: + +- [ ] My code follows the style guidelines of this project +- [ ] I have performed a self-review of my own code +- [ ] I have commented my code, particularly in hard-to-understand areas +- [ ] I have made corresponding changes to the documentation +- [ ] My changes generate no new warnings +- [ ] I have added tests that prove my fix is effective or that my feature works +- [ ] New and existing unit tests pass locally with my changes +- [ ] Any dependent changes have been merged and published in downstream modules diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..9aeae18 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,36 @@ +# SecurityPolicies and Procedures + +## Reporting a Bug + +The Rodney Lab team and community take all security bugs in Rodney Lab repos +seriously. Thank you for improving the security of Rodney Lab repos. We +appreciate your efforts and responsible disclosure and will make every effort to +acknowledge your contributions. + +Report security bugs by emailing security@rodneylab.com. + +You can encrypt your message +using +this PGP public key. + +That account will acknowledge your email within 48 hours, and will send a more +detailed response within 48 hours indicating the next steps in handling your +report. After the initial reply to your report, we will endeavour to keep you +informed of the progress towards a fix and full announcement, and may ask for +additional information or guidance. + +## Disclosure Policy + +When we receive a security bug report, we will assign it to a primary handler. +This person will coordinate the fix and release process, involving the following +steps: + +- Confirm the problem and determine the affected versions. +- Audit code to find any potential similar problems. +- Prepare fixes for all releases still under maintenance. These fixes will be + released as fast as possible. + +## Comments on this Policy + +If you have suggestions on how this process could be improved please submit a +pull request. diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1557067 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily + - package-ecosystem: cargo + directory: / + schedule: + interval: daily diff --git a/.github/workflows/audit-on-push.yml b/.github/workflows/audit-on-push.yml new file mode 100644 index 0000000..bcd7ec6 --- /dev/null +++ b/.github/workflows/audit-on-push.yml @@ -0,0 +1,16 @@ +name: Security audit +permissions: + contents: read +on: + push: + paths: + - 'Cargo.toml' + - 'Cargo.lock' +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..97196e8 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,25 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, +# surfacing known-vulnerable versions of the packages declared or updated in the PR. +# Once installed, if the workflow run is marked as required, +# PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +name: 'Dependency Review' +on: [pull_request] +permissions: + contents: read +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - name: 'Checkout Repository' + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: 'Dependency Review' + uses: actions/dependency-review-action@a6993e2c61fd5dc440b409aa1d6904921c5e1894 # v4.3.5 diff --git a/.github/workflows/general.yml b/.github/workflows/general.yml new file mode 100644 index 0000000..80de329 --- /dev/null +++ b/.github/workflows/general.yml @@ -0,0 +1,150 @@ +name: Rust +on: + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + branches: + - main +permissions: read-all +env: + CARGO_TERM_COLOR: always + RUSTFLAGS: "-Dwarnings -Cinstrument-coverage" + LLVM_PROFILE_FILE: "project-%p-%m.profraw" +jobs: + test: + name: Test + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - name: Install Linux Dependencies + run: sudo apt-get update && sudo apt-get install sqlite3-dev -y + - name: Cache sqlx-cli + id: cache-sqlx + with: + path: ~/.cargo/bin/sqlx ~/.cargo/bin/cargo-sqlx + key: ${{ runner.os }}-sqlx-${{ env.SQX_VERSION }} + - name: Install sqlx-cli + uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + if: steps.cache-sqlx.outputs.cache-hit == false + run: / cargo install sqlx-cli --force--version --version=${{ env.SQX_VERSION}} --features=${{ env.SQX_FEATURES}} --no-default-features --locked + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + - name: Migrate database + run: ./scripts/init_db.sh + - name: Run tests + run: cargo test + fmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + with: + components: rustfmt + - name: Enforce formatting + run: cargo fmt --check + fmt-dprint: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: dprint/check@2f1cf31537886c3bfb05591c031f7744e48ba8a1 # v2.2 + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Linux Dependencies + run: sudo apt-get update && sudo apt-get install sqlite3-dev -y + - name: Cache sqlx-cli + id: cache-sqlx + with: + path: ~/.cargo/bin/sqlx ~/.cargo/bin/cargo-sqlx + key: ${{ runner.os }}-sqlx-${{ env.SQX_VERSION }} + - name: Install sqlx-cli + uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + if: steps.cache-sqlx.outputs.cache-hit == false + run: / cargo install sqlx-cli --force--version --version=${{ env.SQX_VERSION}} --features=${{ env.SQX_FEATURES}} --no-default-features --locked + - uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + with: + components: clippy + - name: Migrate database + run: ./scripts/init_db.sh + - name: Linting + run: cargo clippy -- -D warnings + msrv: + runs-on: ubuntu-latest + strategy: + matrix: + msrv: ["1.64.0"] + name: ubuntu / ${{ matrix.msrv }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Linux Dependencies + run: sudo apt-get update + - name: Install ${{ matrix.msrv }} + uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + with: + toolchain: ${{ matrix.msrv }} + - name: cargo +${{ matrix.msrv }} check + run: cargo check + coverage: + name: Code coverage + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - name: Install Linux Dependencies + run: sudo apt-get update && sudo apt-get install sqlite3-dev -y + - name: Cache sqlx-cli + id: cache-sqlx + with: + path: / ~/.cargo/bin/sqlx ~/.cargo/bin/cargo-sqlx + key: ${{ runner.os }}-sqlx-${{ env.SQX_VERSION }} + - name: Install sqlx-cli + uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + if: steps.cache-sqlx.outputs.cache-hit == false + run: cargo install sqlx-cli --force --version=${{ env.SQX_VERSION}} --features=${{ env.SQX_FEATURES}} --no-default-features --locked + - name: Checkout repository + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + with: + components: llvm-tools-preview + - name: Install grcov + run: cargo install grcov + - name: Migrate database + run: ./scripts/init_db.sh + - name: Build + run: cargo build + - name: Run tests + run: cargo test + - name: Generate code coverage + run: grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/ + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0 + with: + file: ./target/debug/lcov + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..b72b0d2 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,40 @@ +name: pre-commit +on: + push: + branches: [main, master, dev] + pull_request: + branches: [main, master, dev] +permissions: + contents: read +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Install Linux Dependencies + run: sudo apt-get update && sudo apt-get install sqlite3-dev -y + - name: Cache sqlx-cli + id: cache-sqlx + with: + path: ~/.cargo/bin/sqlx ~/.cargo/bin/cargo-sqlx + key: ${{ runner.os }}-sqlx-${{ env.SQX_VERSION }} + - name: Install sqlx-cli + uses: dtolnay/rust-toolchain@4f366e621dc8fa63f557ca04b8f4361824a35a45 # stable + if: steps.cache-sqlx.outputs.cache-hit == false + run: / cargo install sqlx-cli --force--version --version=${{ env.SQX_VERSION}} --features=${{ env.SQX_FEATURES}} --no-default-features --locked + - uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0 + with: + python-version: '3.13' + - uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 + with: + go-version: '>=1.18.0' + - name: Migrate database + run: ./scripts/init_db.sh + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + env: + SKIP: no-commit-to-branch diff --git a/.github/workflows/scheduled-audit.yml b/.github/workflows/scheduled-audit.yml new file mode 100644 index 0000000..ccbc7d9 --- /dev/null +++ b/.github/workflows/scheduled-audit.yml @@ -0,0 +1,14 @@ +name: Security audit +on: + schedule: + - cron: '22 7 * * *' +permissions: + contents: read +jobs: + audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: rustsec/audit-check@69366f33c96575abad1ee0dba8212993eecbe998 # v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml new file mode 100644 index 0000000..41596af --- /dev/null +++ b/.github/workflows/scorecard.yml @@ -0,0 +1,70 @@ +# This workflow uses actions that are not certified by GitHub. They are provided +# by a third-party and are governed by separate terms of service, privacy +# policy, and support documentation. + +name: Scorecard supply-chain security +on: + # For Branch-Protection check. Only the default branch is supported. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection + branch_protection_rule: + # To guarantee Maintained check is occasionally updated. See + # https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained + schedule: + - cron: '48 20 * * 0' + push: + branches: ["main"] +# Declare default permissions as read only. +permissions: read-all +jobs: + analysis: + name: Scorecard analysis + runs-on: ubuntu-latest + permissions: + # Needed to upload the results to code-scanning dashboard. + security-events: write + # Needed to publish results and get a badge (see publish_results below). + id-token: write + # Uncomment the permissions below if installing in a private repository. + # contents: read + # actions: read + steps: + - name: Harden Runner + uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 + with: + egress-policy: audit + disable-telemetry: true + - name: "Checkout code" + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + persist-credentials: false + - name: "Run analysis" + uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0 + with: + results_file: results.sarif + results_format: sarif + # (Optional) "write" PAT token. Uncomment the `repo_token` line below if: + # - you want to enable the Branch-Protection check on a *public* repository, or + # - you are installing Scorecard on a *private* repository + # To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat. + repo_token: ${{ secrets.SCORECARD_TOKEN }} + # Public repositories: + # - Publish results to OpenSSF REST API for easy access by consumers + # - Allows the repository to include the Scorecard badge. + # - See https://github.com/ossf/scorecard-action#publishing-results. + # For private repositories: + # - `publish_results` will always be set to `false`, regardless + # of the value entered here. + publish_results: true + # Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF + # format to the repository Actions tab. + - name: "Upload artifact" + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3 + with: + name: SARIF file + path: results.sarif + retention-days: 5 + # Upload the results to GitHub's code scanning dashboard. + - name: "Upload to code-scanning" + uses: github/codeql-action/upload-sarif@662472033e021d55d94146f66f6058822b0b39fd # v3.27.0 + with: + sarif_file: results.sarif diff --git a/.github/workflows/validate-licenses.yml b/.github/workflows/validate-licenses.yml new file mode 100644 index 0000000..4f44444 --- /dev/null +++ b/.github/workflows/validate-licenses.yml @@ -0,0 +1,19 @@ +name: Cargo Deny +on: [push, pull_request] +permissions: + contents: read +jobs: + cargo-deny: + runs-on: ubuntu-22.04 + strategy: + matrix: + checks: + - advisories + - bans licenses sources + # Prevent sudden announcement of a new advisory from failing ci: + continue-on-error: ${{ matrix.checks == 'advisories' }} + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: EmbarkStudios/cargo-deny-action@8371184bd11e21dcf8ac82ebf8c9c9f74ebf7268 # v2.0.1 + with: + command: check ${{ matrix.checks }} diff --git a/.gitignore b/.gitignore index b702f4f..075c098 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ rusty-tags.vi video.tape *.profraw +sqlite.db* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a36d013 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,32 @@ +repos: + - repo: https://github.com/commitizen-tools/commitizen + rev: v3.30.0 + hooks: + - id: commitizen + stages: + - commit-msg + - repo: https://github.com/doublify/pre-commit-rust + rev: v1.0 + hooks: + - id: fmt + - id: cargo-check + - id: clippy + - repo: https://github.com/gitleaks/gitleaks + rev: v8.21.1 + hooks: + - id: gitleaks + - repo: https://github.com/google/yamlfmt + rev: v0.13.0 + hooks: + - id: yamlfmt + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + args: + - --markdown-linebreak-ext=md + - id: end-of-file-fixer + - id: check-yaml + - id: check-json + exclude: .vscode + - id: no-commit-to-branch diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..668aa49 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,129 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity and +orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behaviour that contributes to a positive environment for our +community include: + +- Demonstrating empathy and kindness toward other people +- Being respectful of differing opinions, viewpoints, and experiences +- Giving and gracefully accepting constructive feedback +- Accepting responsibility and apologising to those affected by our mistakes, + and learning from the experience +- Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behaviour include: + +- The use of sexualised language or imagery, and sexual attention or advances of + any kind +- Trolling, insulting or derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or email address, + without their explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behaviour and will take appropriate and fair corrective action in +response to any behaviour that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +ask@rodneylab.com. All complaints will be reviewed and investigated promptly and +fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behaviour deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behaviour was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behaviour. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behaviour. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behaviour, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..24e6529 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2024, Rodney Johnson +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README.md b/README.md index fc08fd2..7606130 100644 --- a/README.md +++ b/README.md @@ -105,5 +105,4 @@ The repo is just intended as a reference to speed up creating am Axum-based Grap ## ☎️ Issues -Feel free to jump into the -[Rodney Lab matrix chat room](https://matrix.to/#/%23rodney:matrix.org). +# Feel free to jump into the[Rodney Lab matrix chat room](https://matrix.to/#/%23rodney:matrix.org). diff --git a/migrations/20241018164225_create_post_table.sql b/migrations/20241018164225_create_post_table.sql index 42ebd30..579ea9d 100644 --- a/migrations/20241018164225_create_post_table.sql +++ b/migrations/20241018164225_create_post_table.sql @@ -4,4 +4,4 @@ CREATE TABLE "Post" ( "title" TEXT NOT NULL, "body" TEXT NOT NULL, "published" BOOLEAN NOT NULL DEFAULT false -); \ No newline at end of file +); diff --git a/public/static/css/index.css b/public/static/css/index.css index 4558934..b5d3233 100644 --- a/public/static/css/index.css +++ b/public/static/css/index.css @@ -42,4 +42,4 @@ code { font-family: Consolas, monospace; } -/*# sourceMappingURL=index.css.map*/ \ No newline at end of file +/*# sourceMappingURL=index.css.map*/ diff --git a/scripts/init_db.sh b/scripts/init_db.sh new file mode 100755 index 0000000..11dd1ea --- /dev/null +++ b/scripts/init_db.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +set -x +set -eo pipefail + +if ! [ -x "$(command -v sqlite3)" ]; then + echo >&2 "Error: sqlite3 is not installed." + exit 1 +fi + +if ! [ -x "$(command -v sqlx)" ]; then + echo >&2 "Error: sqlx is not installed." + echo >&2 "Use:" + echo >&2 " cargo install --version='~0.8' sqlx-cli \ + --no-default-features --features runtime-tokio-rustls,postgres" + echo >&2 "to install it." + exit 1 +fi + +DATABASE_URL=sqlite://sqlite.db +export DATABASE_URL +sqlx database create +sqlx migrate run + +>&2 echo "SQLite has been migrated, ready to go!" diff --git a/sqlite.db b/sqlite.db deleted file mode 100644 index 9686d54..0000000 Binary files a/sqlite.db and /dev/null differ