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

ハードウェアのコネクタを変更しました。 #16

Closed
wants to merge 56 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
36680f5
update script
csenet Apr 9, 2023
fe44939
add redis
csenet Apr 26, 2023
d50ba5c
add redis
csenet Apr 26, 2023
3b7e269
install redis-py
otariidae Apr 28, 2023
19295bc
Merge pull request #2 from ueckoken/add-redis-in-requirements
otariidae Apr 28, 2023
7fb9e0d
use debian buster as base image
otariidae Apr 28, 2023
ca6fcc6
add redis server to dev containers
otariidae Apr 28, 2023
7e5ad23
fix tests
otariidae Apr 29, 2023
2dd8e23
Update README.md
csenet Apr 29, 2023
c647f23
Merge pull request #7 from ueckoken/fix-test
otariidae Apr 29, 2023
612c884
Merge pull request #3 from ueckoken/debian-based-dev-container
otariidae Apr 29, 2023
d19491a
Merge pull request #4 from ueckoken/redis-devcontainer
otariidae Apr 29, 2023
c4633ea
format by black
otariidae Apr 28, 2023
2b58cd2
Merge pull request #6 from ueckoken/black
otariidae Apr 29, 2023
7d45f4f
softcode Redis connection
otariidae Apr 28, 2023
81ce7e3
softcode Redis connection in tests
otariidae Apr 29, 2023
ec3e0f9
fix redis service container port binding
otariidae Apr 29, 2023
caa3a1b
remove unused lines
otariidae Apr 28, 2023
23d8f3a
Merge pull request #5 from ueckoken/softcoding-redis
otariidae Apr 29, 2023
57dc967
Merge pull request #1 from ueckoken/remove-unused-lines
otariidae Apr 29, 2023
9c4f670
update README
csenet Jun 3, 2023
ee69834
lint by ruff
otariidae Aug 15, 2023
aa514dc
install ruff as a dev dependency
otariidae Aug 15, 2023
034035b
fix keyword arguments
otariidae Aug 15, 2023
cad4cd5
fix typo
otariidae Aug 15, 2023
d07ce2d
add tests for cache expiration
otariidae Aug 15, 2023
45105ed
fix cache expiration
otariidae Aug 15, 2023
6a22ff3
single-responsibility class for card manager and dependency injection…
otariidae Aug 15, 2023
3e3caed
dependency injection for Redis
otariidae Aug 15, 2023
6df16ee
Merge pull request #8 from ueckoken/ruff
otariidae Aug 16, 2023
20ccd64
Merge pull request #11 from ueckoken/card-class-dependency-injection
otariidae Aug 16, 2023
2fc4f3d
Merge pull request #10 from ueckoken/fix-cache-expire
otariidae Aug 16, 2023
e147001
Merge remote-tracking branch 'origin/main' into test-cache
otariidae Aug 16, 2023
1f4cd73
lint, format, and fix wrong conflict resolution
otariidae Aug 16, 2023
2c41881
Merge pull request #9 from ueckoken/test-cache
otariidae Aug 16, 2023
229b15f
Merge remote-tracking branch 'origin/main' into redis-dependency-inje…
otariidae Aug 16, 2023
f7732a8
Merge pull request #12 from ueckoken/redis-dependency-injection
otariidae Aug 16, 2023
aeded58
use timedelta instead of primitive int
otariidae Aug 17, 2023
8bc6e98
externalize authentication logic and add interface to verify
otariidae Aug 18, 2023
aa4795b
pin pip to the current latest version
otariidae Aug 19, 2023
601f420
install git in Dev Container
otariidae Aug 19, 2023
1c44496
flat layout
otariidae Aug 19, 2023
50d2a52
lint
otariidae Aug 19, 2023
875c3a3
fix patch
otariidae Aug 20, 2023
cf7f152
Merge pull request #13 from ueckoken/timedelta
otariidae Aug 21, 2023
20eea73
Merge remote-tracking branch 'origin/main' into verify-interface
otariidae Aug 21, 2023
0ac1e32
Merge pull request #15 from ueckoken/fix-pip
otariidae Aug 21, 2023
a0a3edf
Merge pull request #16 from ueckoken/install-git-in-devcontainer
otariidae Aug 21, 2023
c437d3e
Merge pull request #14 from ueckoken/verify-interface
otariidae Aug 21, 2023
22c1a63
Merge remote-tracking branch 'origin/main' into flat-layout
otariidae Aug 21, 2023
7292a1c
Merge pull request #17 from ueckoken/flat-layout
otariidae Aug 21, 2023
98ecc89
do not hard-code API base URL
otariidae Aug 22, 2023
1a3a61f
Merge pull request #18 from ueckoken/api-env
otariidae Aug 25, 2023
fbe0926
add kicad data
acaValkyrie Apr 12, 2024
5eb9b4a
ピン情報を追加
acaValkyrie Apr 12, 2024
025abfb
コネクタをXHに、電源用コネクタをType-Cに変更
acaValkyrie Apr 16, 2024
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
66 changes: 45 additions & 21 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,54 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.245.2/containers/docker-existing-dockerfile
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-docker-compose
{
"name": "Existing Dockerfile",

// Sets the run context to one level up instead of the .devcontainer folder.
"context": "..",

// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerFile": "../Dockerfile.dev",

"workspaceFolder": "/app",
"workspaceMount": "source=${localWorkspaceFolder},target=/app,type=bind,consistency=cached"

"name": "Existing Docker Compose (Extend)",

// Update the 'dockerComposeFile' list if you have more compose files or use different names.
// The .devcontainer/docker-compose.yml file contains any overrides you need/want to make.
"dockerComposeFile": [
"../docker-compose.dev.yaml",
"docker-compose.yml"
],

// The 'service' property is the name of the service for the container that VS Code should
// use. Update this value and .devcontainer/docker-compose.yml to the real service name.
"service": "km4k",

// The optional 'workspaceFolder' property is the path VS Code should open by default when
// connected. This is typically a file mount in .devcontainer/docker-compose.yml
"workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python"
]
}
},
"features": {
"ghcr.io/devcontainers/features/git:1": {
"ppa": true,
"version": "os-provided"
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Uncomment the next line to run commands after the container is created - for example installing curl.
// "postCreateCommand": "apt-get update && apt-get install -y curl",
// Uncomment the next line if you want start specific services in your Docker Compose config.
// "runServices": [],

// Uncomment the next line if you want to keep your containers running after VS Code shuts down.
// "shutdownAction": "none",

// Uncomment when using a ptrace-based debugger like C++, Go, and Rust
// "runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
// Uncomment the next line to run commands after the container is created.
// "postCreateCommand": "cat /etc/os-release",

// Uncomment to use the Docker CLI from inside the container. See https://aka.ms/vscode-remote/samples/docker-from-docker.
// "mounts": [ "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" ],
// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as a non-root user if you've added one. See https://aka.ms/vscode-remote/containers/non-root.
// "remoteUser": "vscode"
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
}
26 changes: 26 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.1'
services:
# Update this to the name of the service you want to work with in your docker-compose.yml file
km4k:
# Uncomment if you want to override the service's Dockerfile to one in the .devcontainer
# folder. Note that the path of the Dockerfile and context is relative to the *primary*
# docker-compose.yml file (the first in the devcontainer.json "dockerComposeFile"
# array). The sample below assumes your primary file is in the root of your project.
#
# build:
# context: .
# dockerfile: .devcontainer/Dockerfile

volumes:
# Update this to wherever you want VS Code to mount the folder of your project
- ..:/workspaces:cached

# Uncomment the next four lines if you will use a ptrace-based debugger like C++, Go, and Rust.
# cap_add:
# - SYS_PTRACE
# security_opt:
# - seccomp:unconfined

# Overrides default command so things don't shut down after the process ends.
command: /bin/sh -c "while sleep 1000; do :; done"

20 changes: 20 additions & 0 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ jobs:

runs-on: ubuntu-20.04

services:
# ref: https://docs.github.com/ja/actions/using-containerized-services/creating-redis-service-containers
redis:
image: redis:alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379

steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand All @@ -26,8 +38,16 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check format
run: black --check --verbose --diff .
- name: Lint
run: ruff check --format github .
- name: Test with unittest and gather code coverage
run: coverage run --branch -m unittest
env:
REDIS_HOST: localhost
REDIS_PORT: 6379
REDIS_DB: 0
- name: Show coverage
run: |
coverage report -m
Expand Down
11 changes: 6 additions & 5 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
FROM python:3.7.3
FROM debian:buster-slim

RUN apt update \
&& apt install -y libusb-1.0-0 \
&& rm -rf /var/lib/apt/lists/*
RUN apt-get update \
&& apt-get install -y libusb-1.0-0 python3 python3-pip \
&& rm -rf /var/lib/apt/lists/* \
&& python3 -m pip install pip==23.2.1

WORKDIR /app
COPY requirements*.txt /app/
RUN pip install -r requirements-dev.txt
RUN pip3 install -r requirements-dev.txt

COPY *.py /app/
163 changes: 0 additions & 163 deletions KM4K.py

This file was deleted.

32 changes: 8 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,23 @@
# KagiMod for Koken (KM4K)
# KagiMod for Koken ver.2 (KM4K2)

## How to Use
KagiMod for Kokenを元にして認証機能を切り離したものです。

### Register

```
$ ./Register.sh
Add User
name> kokenuser
Touch your Suica
Registered (idm:****)
$
```

### Unregister

```
$ ./Unregister.sh
Delete User
name> kokenuser
Deleted (name:kokenuser)
$
```
RedisにIdmをキャッシュすることによって高速な認証を実現しています。

### Launch

KM4K.serviceはsystemdに登録されています。

```
systemctl status KM4K
systemctl status KM4K2
```

で確認

### 環境変数

- `VERIFY_API_URL` : CardManagerのカード認証用エンドポイント
- `CARD_MANAGER_BASE_URL` : CardManagerのAPIベースURL
- `API_KEY` : CardManagerのAPI-Key
- `REDIS_HOST` : Redisサーバーのホスト名
- `REDIS_PORT` : Redisサーバーのポート番号
- `REDIS_DB` : RedisサーバーのDB番号
6 changes: 0 additions & 6 deletions Register.sh

This file was deleted.

3 changes: 0 additions & 3 deletions Reset.py

This file was deleted.

6 changes: 0 additions & 6 deletions Unregister.sh

This file was deleted.

Loading
Loading