mirror of
https://github.com/kremalicious/umami.git
synced 2024-12-22 09:13:37 +01:00
Fix css issue.
This commit is contained in:
parent
dc267f8daa
commit
585706cc16
68
cli.js
68
cli.js
@ -1,68 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
function _interopDefault(ex) {
|
||||
return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
|
||||
}
|
||||
|
||||
require('dotenv/config');
|
||||
var yargs = _interopDefault(require('yargs'));
|
||||
var chalk = _interopDefault(require('chalk'));
|
||||
var client = require('@prisma/client');
|
||||
|
||||
const prisma = new client.PrismaClient({
|
||||
log: [
|
||||
{
|
||||
emit: 'event',
|
||||
level: 'query',
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
prisma.on('query', e => {
|
||||
if (process.env.LOG_QUERY) {
|
||||
console.log(`${e.query} (${e.duration}ms)`);
|
||||
}
|
||||
});
|
||||
|
||||
var createAccount = async () => {
|
||||
const account = await prisma.account.findOne({
|
||||
where: {
|
||||
username: 'admin',
|
||||
},
|
||||
});
|
||||
|
||||
if (!account) {
|
||||
await prisma.account.create({
|
||||
data: {
|
||||
username: 'admin',
|
||||
password: '$2a$10$BXHPV7APlV1I6WrKJt1igeJAyVsvbhMTaTAi3nHkUJFGPsYmfZq3y',
|
||||
is_admin: true,
|
||||
},
|
||||
});
|
||||
console.log('Account succesfully created.');
|
||||
} else {
|
||||
console.log('Account already exists.');
|
||||
}
|
||||
};
|
||||
|
||||
const cmd = yargs.usage('Usage: umami <command> [arguments]').help('h').alias('h', 'help');
|
||||
|
||||
const { argv } = cmd;
|
||||
const {
|
||||
_: [action, ...params],
|
||||
} = argv;
|
||||
|
||||
const exec = async () => {
|
||||
if (action === 'create') {
|
||||
await createAccount();
|
||||
} else {
|
||||
cmd.showHelp();
|
||||
}
|
||||
|
||||
console.log(chalk.green('Finished.'));
|
||||
};
|
||||
|
||||
exec().then(() => {
|
||||
process.exit(0);
|
||||
});
|
@ -1,22 +0,0 @@
|
||||
import { prisma } from '../lib/db';
|
||||
|
||||
export default async () => {
|
||||
const account = await prisma.account.findOne({
|
||||
where: {
|
||||
username: 'admin',
|
||||
},
|
||||
});
|
||||
|
||||
if (!account) {
|
||||
await prisma.account.create({
|
||||
data: {
|
||||
username: 'admin',
|
||||
password: '$2a$10$BXHPV7APlV1I6WrKJt1igeJAyVsvbhMTaTAi3nHkUJFGPsYmfZq3y',
|
||||
is_admin: true,
|
||||
},
|
||||
});
|
||||
console.log('Account succesfully created.');
|
||||
} else {
|
||||
console.log('Account already exists.');
|
||||
}
|
||||
};
|
7
cli/init.js
Normal file
7
cli/init.js
Normal file
@ -0,0 +1,7 @@
|
||||
import term from 'terminal-kit';
|
||||
|
||||
const { terminal } = term;
|
||||
|
||||
export default function init() {
|
||||
terminal('hello!');
|
||||
}
|
@ -10,6 +10,7 @@
|
||||
line-height: 40px;
|
||||
min-height: 40px;
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.label {
|
||||
|
84
prisma/schema.mysql.prisma
Normal file
84
prisma/schema.mysql.prisma
Normal file
@ -0,0 +1,84 @@
|
||||
generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "mysql"
|
||||
url = env("DATABASE_URL")
|
||||
}
|
||||
|
||||
model account {
|
||||
user_id Int @default(autoincrement()) @id
|
||||
username String @unique
|
||||
password String
|
||||
is_admin Boolean @default(false)
|
||||
created_at DateTime? @default(now())
|
||||
updated_at DateTime? @default(now())
|
||||
website website[]
|
||||
}
|
||||
|
||||
model event {
|
||||
event_id Int @default(autoincrement()) @id
|
||||
website_id Int
|
||||
session_id Int
|
||||
created_at DateTime? @default(now())
|
||||
url String
|
||||
event_type String
|
||||
event_value String
|
||||
session session @relation(fields: [session_id], references: [session_id])
|
||||
website website @relation(fields: [website_id], references: [website_id])
|
||||
|
||||
@@index([created_at], name: "event_created_at_idx")
|
||||
@@index([session_id], name: "event_session_id_idx")
|
||||
@@index([website_id], name: "event_website_id_idx")
|
||||
}
|
||||
|
||||
model pageview {
|
||||
view_id Int @default(autoincrement()) @id
|
||||
website_id Int
|
||||
session_id Int
|
||||
created_at DateTime? @default(now())
|
||||
url String
|
||||
referrer String?
|
||||
session session @relation(fields: [session_id], references: [session_id])
|
||||
website website @relation(fields: [website_id], references: [website_id])
|
||||
|
||||
@@index([created_at], name: "pageview_created_at_idx")
|
||||
@@index([session_id], name: "pageview_session_id_idx")
|
||||
@@index([website_id], name: "pageview_website_id_idx")
|
||||
}
|
||||
|
||||
model session {
|
||||
session_id Int @default(autoincrement()) @id
|
||||
session_uuid String @unique
|
||||
website_id Int
|
||||
created_at DateTime? @default(now())
|
||||
hostname String?
|
||||
browser String?
|
||||
os String?
|
||||
device String?
|
||||
screen String?
|
||||
language String?
|
||||
country String?
|
||||
website website @relation(fields: [website_id], references: [website_id])
|
||||
event event[]
|
||||
pageview pageview[]
|
||||
|
||||
@@index([created_at], name: "session_created_at_idx")
|
||||
@@index([website_id], name: "session_website_id_idx")
|
||||
}
|
||||
|
||||
model website {
|
||||
website_id Int @default(autoincrement()) @id
|
||||
website_uuid String @unique
|
||||
user_id Int
|
||||
name String
|
||||
domain String?
|
||||
created_at DateTime? @default(now())
|
||||
account account @relation(fields: [user_id], references: [user_id])
|
||||
event event[]
|
||||
pageview pageview[]
|
||||
session session[]
|
||||
|
||||
@@index([user_id], name: "website_user_id_idx")
|
||||
}
|
@ -79,4 +79,6 @@ model website {
|
||||
event event[]
|
||||
pageview pageview[]
|
||||
session session[]
|
||||
|
||||
@@index([user_id], name: "website_user_id_idx")
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
import 'dotenv/config';
|
||||
import hashbang from 'rollup-plugin-hashbang';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
|
||||
export default {
|
||||
input: 'cli/index.js',
|
||||
output: {
|
||||
file: 'cli.js',
|
||||
format: 'cjs',
|
||||
},
|
||||
plugins: [
|
||||
hashbang(),
|
||||
commonjs({
|
||||
include: 'node_modules/**',
|
||||
}),
|
||||
],
|
||||
external: ['yargs', 'chalk', 'dotenv/config', '@prisma/client'],
|
||||
};
|
Loading…
Reference in New Issue
Block a user