Skip to content

Commit 8208395

Browse files
committed
Fix #1 plantnet identification on BlueSky
fix warn / distinct simulate / add deltaHours / fix tests
1 parent cc75c85 commit 8208395

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+9609
-6
lines changed

.github/CONTRIBUTING.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
[ < Back](../README.md)
2+
3+
# HowTo Contribute
4+
5+
Please create an [issue](https://github.com/boly38/botEnSky/issues) describing your goal / question / bug description...
6+
7+
If you're interested in an existing issue, please contribute by up-voting for it by adding a :+1:.
8+
9+
If you want to push some code :
10+
- fork and prepare a feature-git-branch, then create a [pull request](https://github.com/boly38/botEnSky/pulls) that link your issue.
11+
- execute tests
12+
13+
You could also be critic with existing ticket/PR : all constructive feedbacks are welcome.
14+
15+
## HowTo execute tests
16+
* launch tests using `npm test`.
17+
18+
Think about environment setup.
19+
20+
21+
## Basis reminder
22+
Clone this repository from GitHub:
23+
24+
```
25+
$ git clone https://github.com/boly38/botEnSky.git
26+
```
27+
28+
### Prerequisites
29+
30+
1. Install NodeJs (https://nodejs.org/en/download/)
31+
2. Install dependencies
32+
```bash
33+
npm install
34+
```
35+
36+
### Set your own private environment
37+
38+
- study each required environment variable in the [template](../env/.env.template)
39+
- copy the template in a private file
40+
```bash
41+
cp ./env/.env.template ./env/.env.development
42+
```
43+
44+
### Start the bot
45+
46+
Execute the application
47+
```bash
48+
npm startDev
49+
```
50+
or (production mode)
51+
```bash
52+
npm run start
53+
```
54+
55+
## PullRequests additional information
56+
Activated bot:
57+
- [houndci](https://houndci.com/)

.github/workflows/audit.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: botensky-audit
2+
3+
on:
4+
schedule:
5+
- cron: '0 10 * * *'
6+
# Allows you to run this workflow manually from the Actions tab
7+
workflow_dispatch:
8+
9+
jobs:
10+
scan:
11+
name: npm audit
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
17+
node-version: [18.x]
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v3
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
28+
- name: Install dependencies
29+
# - run: npm ci # need package.json.lock
30+
run: |
31+
echo "install"
32+
npm install
33+
echo "show outdated (if any)"
34+
npm outdated --depth=3 || echo "you must think about update your dependencies :)"
35+
36+
- name: Audit backend
37+
uses: oke-py/[email protected]
38+
with:
39+
audit_level: moderate
40+
github_token: ${{ secrets.GITHUB_TOKEN }}
41+
issue_assignees: boly38
42+
issue_labels: cybersecurity,bot-created
43+
dedupe_issues: true

.github/workflows/main.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# continuous integration
2+
name: botensky-ci
3+
4+
# Controls when the action will run.
5+
on:
6+
# Triggers the workflow on push or pull request events but only for the prod branch
7+
push:
8+
branches: [ main ]
9+
pull_request:
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
build:
18+
# The type of runner that the job will run on
19+
runs-on: ubuntu-latest
20+
21+
strategy:
22+
matrix:
23+
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
24+
node-version: [18.x]
25+
26+
environment: github_actions_bes #NODE_ENV=test
27+
steps:
28+
- uses: actions/checkout@v3
29+
30+
- name: Use Node.js ${{ matrix.node-version }}
31+
uses: actions/setup-node@v3
32+
with:
33+
node-version: ${{ matrix.node-version }}
34+
35+
- name: Install dependencies
36+
# npx force-resolutions : in case of Permission denied: run it locally to fix package-lock.json
37+
run: |
38+
echo "install"
39+
npm install
40+
echo "show outdated (if any)"
41+
npm outdated --depth=3 || echo "you must think about update your dependencies :)"

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,10 @@ dist
128128
.yarn/build-state.yml
129129
.yarn/install-state.gz
130130
.pnp.*
131+
132+
# IntelliJ
133+
.idea/
134+
*.iml
135+
136+
# wip
137+
draft/

.hound.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# jshint last release was 2 years ago, and hang locally
2+
jshint:
3+
config_file: .jshintrc
4+
# ESLint supported version
5+
# http://help.houndci.com/en/articles/2461415-supported-linters
6+
eslint:
7+
enabled: true
8+
version: 8.1.0
9+
config_file: .hound_eslint_config.json

.hound_eslint_config.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"root": true,
3+
"extends": [
4+
"eslint:recommended"
5+
],
6+
"env" : {
7+
"browser" : true,
8+
"node" : true,
9+
"es6" : true
10+
},
11+
"parserOptions": {
12+
"sourceType": "module",
13+
"ecmaVersion": 2022
14+
},
15+
"plugins": [
16+
],
17+
"rules": {
18+
}
19+
}

.jshintrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"esversion": 6
3+
}

README.md

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
1-
#botEnSky
1+
# botEnSky
22

3-
botEnSky is a bot [BlueSky social app](https://bsky.app/)
3+
botEnSky is a [BlueSky social app](https://bsky.app/) bot born on May 16, 2024.
4+
- written in JavaScript (Node.js ESM Project),
5+
- the worthy successor to [@botentrain1](https://twitter.com/botentrain1) (ex Twitter bot - [code](https://github.com/boly38/botEnTrain)) but for BlueSky.
46

5-
- status: **Started May 16, work in progress**
7+
The goal is to bring happiness to Bluesky users.
68

7-
It is a NodeJs application that relies on [bsky api](https://docs.bsky.app/).
9+
## References
810

9-
The goal is to be the worthy successor to [@botentrain1](https://twitter.com/botentrain1) ([src](https://github.com/boly38/botEnTrain)) but for BlueSky.
11+
- **BlueSky 🤖 Bot account : [@botensky.bsky.social](https://bsky.app/profile/botensky.bsky.social)** 🤖
12+
- Bot webPage : [botensky.onrender.com](https://botensky.onrender.com/)
1013

11-
The search is not the same between the two networks (X, Bsky), so we will have to think about new designs, but the first function considered is plant identification
14+
## Bot features (plugins)
15+
16+
- French help - cf. [botensky.onrender.com](https://botEnSky.onrender.com)
17+
- English [releases notes](https://github.com/boly38/botEnSky/releases) - via [![Automated Release Notes by gren](https://img.shields.io/badge/%F0%9F%A4%96-release%20notes-00B2EE.svg)](https://github-tools.github.io/github-release-notes/)
18+
19+
## How to contribute ?
20+
21+
cf. [CONTRIBUTING](.github/CONTRIBUTING.md)
22+
23+
### Credits
24+
25+
Application and code structure:
26+
- [NodeJs](https://nodejs.org/) and Node dependencies (cf. [graph](https://github.com/boly38/botEnSky/network/dependencies))
27+
- [BlueSky API](https://docs.bsky.app/)
28+
29+
Services ( having free plan 🚀 🌷 )
30+
- [GitHub Actions](https://github.com/features/actions)
31+
- [Render](https://render.com/) free app hosting and automated deployments
32+
- [Cron-job.org](https://cron-job.org/) scheduler
33+
- [PlantNet.org](https://plantnet.org) ([API](https://my.plantnet.org/)) - plant identification service
34+
35+
Team:
36+
- cf. [contributors](https://github.com/boly38/botEnSky/graphs/contributors)

bin/commonEnv.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import dotEnvFlow from 'dotenv-flow';
2+
export const initEnv = () => {
3+
//~ project init of environment
4+
dotEnvFlow.config({ path: './env/' });
5+
}

bin/sandbox.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import console from "node:console";
2+
import {initEnv} from "./commonEnv.js";
3+
import ApplicationConfig from '../src/config/ApplicationConfig.js';
4+
5+
initEnv();
6+
const appConfig = ApplicationConfig.getInstance();
7+
8+
const showResultAsJson = result => console.log(JSON.stringify(result, null, 2));
9+
10+
let botService = appConfig.get('botService');
11+
botService.run();
12+
const pluginName = "Plantnet";
13+
await botService.process("0.0.0.0", true, pluginName)
14+
.then(showResultAsJson)
15+
.catch(console.log)

0 commit comments

Comments
 (0)