Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite in the Rust programming language #27

Merged
merged 139 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
92abf1d
add first draft of persistency addon implementation
thebino Jan 2, 2021
2913074
add places365 image addon
thebino Jan 3, 2021
7d5c980
add github workflow and license
thebino Jan 4, 2021
9010975
remove deprecated python version from workflow
thebino Jan 4, 2021
e153514
create environment in workflows
thebino Jan 4, 2021
b796a4e
change required aiohttp version
thebino Jan 4, 2021
af2265d
add discord badge
thebino Jan 4, 2021
289a8d8
activate environment in workflows
thebino Jan 4, 2021
37c8e74
add badges for build status
thebino Jan 4, 2021
ee8265d
add configuration copy for tests
thebino Jan 4, 2021
6b3ac8d
Merge pull request #2 from photos-network/feature/github_actions
thebino Jan 4, 2021
e00e643
remove unused contetxt
thebino Jan 5, 2021
d5100e5
adjust addon comments
thebino Jan 5, 2021
3f4092d
adjust devcontainer settings
thebino Jan 16, 2021
b8ab4c7
add launch.json and default settings for vscode
thebino Jan 16, 2021
0795a77
return mock data
thebino Jan 18, 2021
ab5dc2d
clean up code
thebino Jan 19, 2021
e6291b6
remove old python versions
thebino Jan 19, 2021
7ee9ec9
Merge pull request #3 from photos-network/feature/devcontainer
thebino Jan 19, 2021
83501a2
check for missing auth token
thebino Jan 19, 2021
d42908e
add first draft of oauth/indieauth
thebino Jan 22, 2021
99a50c9
Merge pull request #7 from photos-network/feature/oauth
thebino Jan 25, 2021
0979276
change devcontainer
thebino Jan 30, 2021
851094e
change container settings and add tox configuration
thebino Jan 31, 2021
3786ef7
add oauth2-stateless implementation
thebino Jan 31, 2021
b013cb2
adjust pythonPath and port for devcontainer setup
thebino Feb 4, 2021
3b759aa
handle Authorization Request
thebino Feb 5, 2021
dd02e91
change default python path
thebino Feb 13, 2021
d4419b8
remove unused appPort from devcontainer
thebino Feb 13, 2021
e6a6672
add vs code instruction video
thebino Feb 13, 2021
733f9ef
Merge branch 'development' into feature/oauth2-stateless
thebino Feb 13, 2021
863072e
add oauth2 handling
thebino Feb 13, 2021
d4b480f
remove place365 addon from tests
thebino Feb 14, 2021
be3f0af
adjust config/data dir for tests
thebino Feb 14, 2021
3a664ab
adjust config dir for tests
thebino Feb 14, 2021
1e4b122
adjust config dir for tests
thebino Feb 14, 2021
66b2200
Merge pull request #9 from photos-network/feature/oauth2-stateless
thebino Feb 14, 2021
774f51c
remove session cookies from oauth
thebino Feb 17, 2021
7a7d084
exclude generated files from vscode
thebino Feb 17, 2021
6a0513c
remove pytest arguments
thebino Feb 17, 2021
5f4b390
remove session from tests
thebino Feb 17, 2021
de971c9
skip state if missing
thebino Feb 17, 2021
90ff1eb
increase log state for debuggin
thebino Feb 17, 2021
efd41b5
print file_path for debuggin
thebino Feb 17, 2021
0f86dae
create data dir for tests
thebino Feb 17, 2021
6c82797
create data dir for tests
thebino Feb 17, 2021
ed1bea0
create data dir for tests
thebino Feb 17, 2021
2d9e1da
create data dir for tests
thebino Feb 17, 2021
cf07044
Merge pull request #10 from photos-network/feature/remove_cookies
thebino Feb 17, 2021
4c49581
increase token lifetime to 60minutes
thebino Feb 17, 2021
26fa6c4
Merge pull request #11 from photos-network/feature/token_lifetime
thebino Feb 17, 2021
de7652e
generalize sql base
thebino Mar 7, 2021
22c8d76
track last_login for users, refresh_token after creation and last_use…
thebino Mar 7, 2021
55f0360
Merge pull request #12 from photos-network/feature/last_login
thebino Mar 7, 2021
66a96cd
validate and renew refresh-token when refreshing an access token
thebino Mar 10, 2021
3ce2344
remove oauth debugger
thebino Mar 10, 2021
c4224a3
add Dockerfile
thebino Mar 11, 2021
7ce66a7
track dto files
thebino Mar 11, 2021
f188703
create a default config if necessary
thebino Mar 13, 2021
08a1d15
Merge pull request #13 from photos-network/feature/create_default_config
thebino Mar 13, 2021
4f2ce43
decrease logging level for addon setup
thebino Mar 26, 2021
8cc718d
Merge pull request #14 from photos-network/feature/addons
thebino Mar 26, 2021
9e332a2
read auth client configs from configuration file
thebino Mar 26, 2021
4fa4ede
Merge pull request #15 from photos-network/feature/auth_clients
thebino Mar 26, 2021
ca39ed7
separate authentication and authorization
thebino Mar 26, 2021
51f163a
Merge pull request #16 from photos-network/feature/authorization
thebino Mar 26, 2021
73e063d
add postman collection for development
thebino Mar 26, 2021
bd59921
Merge pull request #17 from photos-network/feature/postman
thebino Mar 27, 2021
f7eeb50
add limit and offset handling
thebino Mar 28, 2021
cade920
Merge pull request #18 from photos-network/feature/postman
thebino Mar 28, 2021
1cdddd7
add user management
thebino Mar 28, 2021
c3d09c9
add observing user directories
thebino Apr 28, 2021
fccb403
Merge pull request #19 from photos-network/feature/user_management
thebino Apr 28, 2021
a2e6764
bump version for release
thebino May 6, 2021
1ea509d
Merge pull request #20 from photos-network/feature/release_bump
thebino May 6, 2021
5cdf41d
trim and lowercase username
thebino May 9, 2021
084217c
Merge pull request #21 from photos-network/bugfix/lower_case_username…
thebino May 9, 2021
b45c315
bump version
thebino May 9, 2021
da9250f
Merge pull request #22 from photos-network/feature/bump
thebino May 9, 2021
d0f4039
enrich metadata and change base url (#23)
thebino Oct 14, 2021
64424d7
change baseUrl from `v1/` to `api/` (#24)
thebino Oct 14, 2021
fd16098
fix base url (#25)
thebino Oct 14, 2021
2de8035
return formated date in photo responses
thebino Nov 18, 2021
e50b775
use configured port for image urls
thebino Nov 18, 2021
96db5b6
return core version on protected request
thebino Nov 18, 2021
dae64af
return with Unauthorized instead of Forbidden
thebino Dec 11, 2021
25b1f45
add missing changelog
thebino Jan 22, 2022
95b1a40
publish app port
thebino Jan 22, 2022
8fb8122
fix tests
thebino Jan 22, 2022
ee9788a
Update CODEOWNERS
thebino Apr 24, 2022
c3a7ad2
Update CODEOWNERS
thebino Apr 24, 2022
337b80c
raise python version and wrap login informations
thebino Apr 30, 2022
8dff540
raise python to 3.10 for tox and CI
thebino Apr 30, 2022
1dd5083
fix CI syntax
thebino Apr 30, 2022
b8cb809
add status code for errors
thebino Jul 2, 2022
1138b1d
add generated client credentials to fallback configuration
thebino Jul 8, 2022
77901da
remove unecessary client_secret from oauth call (#26)
thebino Jul 15, 2022
3ba4101
add first draft of a plugin system w/ rust
thebino Mar 22, 2023
5311bb7
add plugin system draft
thebino Mar 26, 2023
7402983
trigger function on plugins
thebino Mar 27, 2023
b371698
adding draft authentication manager
thebino Apr 1, 2023
8341218
add debug output
thebino Apr 1, 2023
23a73d6
tests for authorization request
thebino Apr 3, 2023
9cade20
draft repository
thebino Jun 19, 2023
d4a7c2c
add debug launch for vscode
thebino Jun 19, 2023
4f9e8b1
adjust some meta informations
thebino Jun 19, 2023
641ee3b
adjust plugin manager to load only if available in the configuration …
thebino Jun 27, 2023
29e18fe
adjust application configuration parsing
thebino Jul 1, 2023
9fae17f
move plugin_interface into core crates directory
thebino Jul 4, 2023
0756b14
fmt
thebino Jul 4, 2023
bd83eeb
clippy
thebino Jul 4, 2023
79202f4
fmt
thebino Jul 4, 2023
758dd73
add first oauth draft
thebino Jul 5, 2023
d01b9c1
add oidc to path and change default callback
thebino Jul 8, 2023
51b061e
clean-up
thebino Jul 9, 2023
185d178
separate authentication from authorization server
thebino Jul 10, 2023
6c868ee
rename activity pub crate
thebino Jul 10, 2023
212fcaa
first draft of media api
thebino Jul 15, 2023
da3ec35
rename media endpoints
thebino Jul 18, 2023
33ec6bb
add more documentations and update media routes
thebino Aug 9, 2023
62b124c
add draft for media api test
thebino Aug 17, 2023
48c0132
add tests for media list request
thebino Aug 17, 2023
bfdbae0
add user extractor and handle multipart formdata uploads
thebino Aug 25, 2023
a154ea8
add optional user extractor
thebino Aug 27, 2023
33b2f41
add media repository
thebino Aug 27, 2023
eb5b041
add sea-orm and sqlx
thebino Aug 28, 2023
9e841e6
clean up and extract database into crate
thebino Aug 28, 2023
d23a478
move config into common
thebino Aug 29, 2023
de4d81e
add generic sqlx database draft (#30)
thebino Sep 15, 2023
8d8893b
upload code coverage
thebino Sep 15, 2023
dfa7836
create code coverage
thebino Sep 15, 2023
fca2866
fix codecov action version
thebino Sep 15, 2023
dd7b5c3
add grcov config
thebino Sep 15, 2023
b791431
add build flags for tests
thebino Sep 15, 2023
742ec89
skip coverage
thebino Sep 15, 2023
61ccdd8
implement post_media
thebino Sep 19, 2023
3d839d3
add post_media with database impl
thebino Oct 10, 2023
f1dbe92
add create_media_item for sqlite
thebino Oct 11, 2023
8a41d74
create media item in repository and database
thebino Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 13 additions & 36 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,14 @@
{
"name": "Photos.network Core",
"context": "..",
"dockerFile": "../Dockerfile.dev",
"forwardPorts": [3000],
"postCreateCommand": "mkdir -p config && pip3 install -e .",
"runArgs": ["-e", "GIT_EDITOR=code --wait"],
"extensions": [
"ms-python.vscode-pylance",
"visualstudioexptteam.vscodeintellicode",
"ms-azure-devops.azure-pipelines",
"redhat.vscode-yaml",
"esbenp.prettier-vscode"
],
"settings": {
"python.pythonPath": "/usr/local/bin/python",
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.formatting.provider": "black",
"python.testing.pytestArgs": ["--no-cov"],
"python.testing.pytestEnabled": true,
"editor.formatOnPaste": false,
"editor.formatOnSave": true,
"editor.formatOnType": true,
"files.trimTrailingWhitespace": true,
"terminal.integrated.shell.linux": "/bin/bash",
"yaml.customTags": [
"!input scalar",
"!secret scalar",
"!include_dir_named scalar",
"!include_dir_list scalar",
"!include_dir_merge_list scalar",
"!include_dir_merge_named scalar"
]
}
}

"name": "Photos.network core",
"image": "mcr.microsoft.com/devcontainers/rust:0-1-bullseye",
"appPort": [
"7777:7777"
],
"extensions": [
"rust-lang.rust-analyzer",
"swellaby.vscode-rust-test-adapter",
"ms-vscode.test-adapter-converter"
],
"postCreateCommand": "rustc --version",
"remoteUser": "vscode"
}
34 changes: 34 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/engine/reference/builder/#dockerignore-file

**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
5 changes: 1 addition & 4 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
# https://github.blog/2017-07-06-introducing-code-owners/

# Add a fallback to default owners
* @thebino

# setup can be reviewed by the core team
setup.py @photos.network/core
* @photos-network/core-team
2 changes: 2 additions & 0 deletions .github/actions-rs/grcov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
output-type: lcov
output-file: ./lcov.info
21 changes: 21 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
# Hold ourselves to a high bar
range: 85..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%

# Test files aren't important for coverage
ignore:
- "tests"

# Make comments less noisy
comment:
layout: "files"
require_changes: yes
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
- package-ecosystem: cargo
directory: /
schedule:
interval: weekly
ignore:
- dependency-name: "*"
# patch and minor updates don't matter for libraries
# remove this ignore rule if your package has binaries
update-types:
- "version-update:semver-patch"
- "version-update:semver-minor"
24 changes: 24 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Configuration file for [stale](https://github.com/apps/stale)

# Number of days of inactivity before an issue becomes stale
daysUntilStale: 60

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security

# Label to use when marking an issue as stale
staleLabel: wontfix

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.

# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
87 changes: 87 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: check code quality

on: [push]

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check

test:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run cargo test
uses: actions-rs/cargo@v1
with:
command: test
args: --workspace --all-targets
# env:
# CARGO_INCREMENTAL: '0'
# RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
# RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'

# - name: rust-grcov
# # You may pin to the exact commit or the version.
# # uses: actions-rs/grcov@bb47b1ed7883a1502fa6875d562727ace2511248
# uses: actions-rs/[email protected]

# - name: Upload coverage reports to Codecov
# uses: codecov/codecov-action@v3
# env:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
# with:
# verbose: true
# fail_ci_if_error: false

lints:
name: Lint checks
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
70 changes: 15 additions & 55 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,62 +1,22 @@
# pytest
.pytest_cache
.cache
### Rust ###
debug/
target/

# GITHUB Proposed Python stuff:
*.py[cod]
# These are backup files generated by rustfmt
**/*.rs.bk

# C extensions
*.so
# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Packages
*.egg
*.egg-info
dist
build
eggs
.eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
pip-wheel-metadata

# Logs
*.log
pip-log.txt
### IntelliJ ###
.idea/

# Unit test / coverage reports
.coverage
.tox
coverage.xml
nosetests.xml
htmlcov/
test-reports/
test-results.xml
test-output.xml
# data directory
/data

# Translations
*.mo
# config directory
/config

# venv stuff
pyvenv.cfg
pip-selfcheck.json
venv
.venv
Pipfile*
share/*
/Scripts/

# Visual Studio Code
.vscode/*
!.vscode/cSpell.json
!.vscode/extensions.json
!.vscode/tasks.json
.env

# Built docs
docs/build
# logs directory
/logs
11 changes: 10 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"recommendations": ["esbenp.prettier-vscode", "ms-python.python"]
"recommendations": [
"rust-lang.rust-analyzer",
"tamasfe.even-better-toml",
"serayuzgur.crates",
"rangav.vscode-thunder-client",
"usernamehw.errorlens",
"dracula-theme.theme-dracula",
"vadimcn.vscode-lldb",
"ms-vscode.cpptools",
],
}
24 changes: 24 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Photos.network (OSX)",
"type": "lldb",
"request": "launch",
"program": "${workspaceRoot}/target/debug/core",
"args": [],
"cwd": "${workspaceRoot}"
},
{
"name": "Photos.network (Windows)",
"type": "cppvsdbg",
"request": "launch",
"program": "${workspaceRoot}/target/debug/core.exe",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceRoot}",
"environment": [],
"externalConsole": true
}
]
}
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"terminal.integrated.defaultProfile.osx": "zsh",
"editor.semanticTokenColorCustomizations": {
"rules": {
"*.mutable": {
"fontStyle": "", // set to empty string to disable underline, which is the default
},
}
},
"rust-analyzer.linkedProjects": [
"./crates/accounts/Cargo.toml",
"./crates/activity_pub/Cargo.toml",
"./crates/common/Cargo.toml",
"./crates/media/Cargo.toml",
"./crates/oauth_authentication/Cargo.toml",
"./crates/oauth_authorization_server/Cargo.toml"
],
"rust-analyzer.showUnlinkedFileNotification": false,
"debug.allowBreakpointsEverywhere": true,
"rest-client.followredirect": false
}
Loading
Loading