Skip to content

Commit 4438f58

Browse files
committed
Merge branch 'next' of github.com:devforth/adminforth into next
2 parents 13a111c + 8fc6c11 commit 4438f58

File tree

15 files changed

+112
-71
lines changed

15 files changed

+112
-71
lines changed

adapters/install-adapters.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ adminforth-email-adapter-mailgun adminforth-google-oauth-adapter adminforth-gith
44
adminforth-facebook-oauth-adapter adminforth-keycloak-oauth-adapter adminforth-microsoft-oauth-adapter \
55
adminforth-twitch-oauth-adapter adminforth-image-generation-adapter-openai adminforth-storage-adapter-amazon-s3 \
66
adminforth-storage-adapter-local adminforth-image-vision-adapter-openai adminforth-key-value-adapter-ram \
7-
adminforth-login-captcha-adapter-cloudflare adminforth-login-captcha-adapter-recaptcha adminforth-completion-adapter-google-gemini"
7+
adminforth-login-captcha-adapter-cloudflare adminforth-login-captcha-adapter-recaptcha adminforth-completion-adapter-google-gemini \
8+
adminforth-key-value-adapter-redis adminforth-key-value-adapter-leveldb"
89

910
# for each
1011
install_adapter() {

adminforth/commands/createApp/templates/.env.local.hbs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
ADMINFORTH_SECRET=123
22
NODE_ENV=development
3+
DEBUG_LEVEL=info
4+
AF_DEBUG_LEVEL=info
5+
DB_DEBUG_LEVEL=info
36
DATABASE_URL={{{dbUrl}}}
47
{{#if prismaDbUrl}}
58
PRISMA_DATABASE_URL={{{prismaDbUrl}}}

adminforth/documentation/docs/tutorial/05-ListOfAdapters.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,49 @@ The RAM adapter is a simplest in-memory key-value storage. Stores data in proces
244244

245245
Pros:
246246
* Simplest in use - does not reqauire any external daemon.
247+
247248
Cones:
248249
* In production sutable for single-process installations only
249250

250251

252+
### Redis adapter
253+
254+
```bash
255+
npm i @adminforth/key-value-adapter-redis
256+
```
257+
258+
Redis adapter uses redis database.
259+
260+
```ts
261+
import RedisKeyValueAdapter from '@adminforth/key-value-adapter-redis';
262+
263+
const adapter = new RedisKeyValueAdapter({
264+
redisUrl: '127.0.0.1:6379'
265+
})
266+
267+
adapeter.set('test-key', 'test-value', 120); //expiry in 120 seconds
268+
269+
```
270+
271+
### LevelDB adapter
272+
273+
```bash
274+
npm i @adminforth/key-value-adapter-leveldb
275+
```
276+
277+
LebelDB uses local storage for storing keys.
278+
279+
```ts
280+
import LevelDBKeyValueAdapter from '@adminforth/key-value-adapter-leveldb'
281+
282+
const adapter = new LevelDBKeyValueAdapter({
283+
dbPath: './testdb'
284+
});
285+
286+
adapeter.set('test-key', 'test-value', 120); //expiry in 120 seconds
287+
288+
```
289+
251290
## 🤖Captcha adapters
252291

253292
Used to add capthca to the login screen

adminforth/modules/logger.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,21 @@ const baseLogger = pino({
66
options: {
77
colorize: true,
88
ignore: 'pid,hostname',
9-
hideObject: true,
10-
messageFormat: '{layer}: {msg}',
119
}
1210
},
1311
});
1412

1513
export const logger = baseLogger.child(
16-
{ layer: 'user_logs' },
17-
{ level: process.env.HEAVY_DEBUG ? 'trace' : ( process.env.DEBUG_LEVEL || 'info' ) }
14+
{ name: 'User logs' },
15+
{ level: process.env.HEAVY_DEBUG ? 'trace' : ( process.env.DEBUG_LEVEL || 'info' ) },
1816
);
1917

2018
export const afLogger = baseLogger.child(
21-
{ layer: 'af' },
19+
{ name: 'AF' },
2220
{ level: process.env.HEAVY_DEBUG ? 'trace' : ( process.env.AF_DEBUG_LEVEL || 'info' ) }
2321
);
2422

2523
export const dbLogger = baseLogger.child(
26-
{ layer: 'db' },
24+
{ name: 'DB' },
2725
{ level: process.env.HEAVY_DEBUG_QUERY ? 'trace' : (process.env.DB_DEBUG_LEVEL|| 'info') }
2826
);

adminforth/spa/src/components/Toast.vue

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,16 @@
1818
<div v-else class="af-toast-icon inline-flex items-center justify-center flex-shrink-0 w-8 h-8 text-green-500 bg-green-100 rounded-lg dark:bg-green-800 dark:text-green-200">
1919
<IconCheckCircleSolid class="w-5 h-5" aria-hidden="true" />
2020
</div>
21-
22-
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-if="toast.messageHtml" v-html="toast.messageHtml"></div>
23-
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-else>
24-
<div class="flex flex-col items-center justify-center break-all">
21+
<div class="flex flex-col items-center justify-center break-all">
22+
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-if="toast.messageHtml" v-html="toast.messageHtml"></div>
23+
<div class="ms-3 text-sm font-normal max-w-xs pr-2" v-else>
2524
{{toast.message}}
26-
<div v-if="toast.buttons" class="flex justify-center mt-2 gap-2">
27-
<div v-for="button in toast.buttons" class="af-toast-button rounded-md bg-lightButtonsBackground hover:bg-lightButtonsHover text-lightButtonsText dark:bg-darkPrimary dark:hover:bg-darkButtonsBackground dark:text-darkButtonsText">
28-
<button @click="onButtonClick(button.value)" class="px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/10">
29-
{{ button.label }}
30-
</button>
31-
</div>
25+
</div>
26+
<div v-if="toast.buttons" class="flex mt-2 gap-2 w-full ml-6">
27+
<div v-for="button in toast.buttons" class="af-toast-button rounded-md bg-lightButtonsBackground hover:bg-lightButtonsHover text-lightButtonsText dark:bg-darkPrimary dark:hover:bg-darkButtonsBackground dark:text-darkButtonsText">
28+
<button @click="onButtonClick(button.value)" class="px-2 py-1 rounded hover:bg-black/5 dark:hover:bg-white/10">
29+
{{ button.label }}
30+
</button>
3231
</div>
3332
</div>
3433
</div>

dev-demo/custom/package-lock.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

dev-demo/custom/package.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

dev-demo/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dev-demo/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"install-adapters": "cd ../adapters && bash install-adapters.sh",
1919
"build-adminforth": "cd ../adminforth && npm ci && npm run build && npm link",
2020
"migrate:all": "npm run migrate:sqlite && npm run migrate:mysql && npm run migrate:postgres && npm run migrate:clickhouse",
21-
"setup-dev-demo": "npm run build-adminforth && cp .env.local .env && npm run install-plugins && npm run install-adapters && npm install && npm link adminforth && bash ./run_inventory.sh"
21+
"preinstall": "node scripts/check-node.js",
22+
"check-docker": "node scripts/check-docker.js",
23+
"setup-dev-demo": "npm run preinstall && npm run check-docker && npm run build-adminforth && cp .env.local .env && npm run install-plugins && npm run install-adapters && npm install && npm link adminforth && bash ./scripts/run_inventory.sh"
2224
},
2325
"author": "",
2426
"license": "ISC",

dev-demo/resources/adminuser.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,11 @@ export default {
141141
}),
142142
new UploadPlugin({
143143
pathColumnName: "avatar",
144-
storageAdapter: new AdminForthAdapterS3Storage({
145-
bucket: process.env.AWS_BUCKET_NAME as string,
146-
region: process.env.AWS_REGION as string,
147-
accessKeyId: process.env.AWS_ACCESS_KEY_ID as string,
148-
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY as string,
144+
storageAdapter: new AdminForthStorageAdapterLocalFilesystem({
145+
fileSystemFolder: "./db/uploads",
146+
adminServeBaseUrl: "static/source",
147+
mode: "public", // or "private"
148+
signingSecret: '1241245',
149149
}),
150150
allowedFileExtensions: [
151151
"jpg",

0 commit comments

Comments
 (0)