Compare commits

..

8 Commits
2.2.2 ... 2.3.1

Author SHA1 Message Date
diced
ef7fbaf1dc 2.3.1 2020-11-06 08:42:16 -08:00
diced
87cf861648 remove ioredis 2020-11-06 08:41:59 -08:00
diced
d414c85efd 2.3.0 2020-11-05 19:47:35 -08:00
diced
5b24a8e415 gravatars 2020-11-05 19:47:22 -08:00
diced
1d348db4dd 2.2.4 2020-11-05 19:20:58 -08:00
diced
ececc3ab0e fix workflow 2020-11-05 19:14:33 -08:00
diced
a71bde9730 teyest 2020-11-05 19:12:35 -08:00
diced
3417a84789 remove some useless stuff 2020-11-05 19:10:19 -08:00
12 changed files with 57 additions and 157 deletions

View File

@@ -1,68 +0,0 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
# ******** NOTE ********
name: "CodeQL"
on:
push:
branches: [ next ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ next ]
schedule:
- cron: '25 2 * * 4'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@@ -23,5 +23,6 @@ jobs:
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- run: npm i -g yarn
- run: yarn
- run: yarn build

View File

@@ -10,8 +10,6 @@
![David](https://img.shields.io/david/dicedtomatoreal/zipline)
![David](https://img.shields.io/david/dev/dicedtomatoreal/zipline)
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/dicedtomatoreal/zipline/react)
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/dicedtomatoreal/zipline/next)
![GitHub package.json dependency version (prod)](https://img.shields.io/github/package-json/dependency-version/dicedtomatoreal/zipline/fastify)
# Zipline
The best and only **React + Next.js** ShareX / File Uploader you would ever want.

View File

@@ -1,6 +1,6 @@
{
"name": "zipline-next",
"version": "2.2.2",
"version": "2.3.1",
"private": true,
"dependencies": {
"@dicedtomato/colors": "^1.0.3",
@@ -23,7 +23,6 @@
"fastify-typeorm-plugin": "^2.1.2",
"figlet": "^1.5.0",
"inquirer": "^7.3.3",
"ioredis": "^4.19.2",
"material-ui-dropzone": "^3.5.0",
"next": "^9.5.4",
"pg": "^8.4.1",
@@ -48,7 +47,6 @@
"devDependencies": {
"@types/bcrypt": "^3.0.0",
"@types/crypto-js": "^3.1.47",
"@types/ioredis": "^4.17.7",
"@types/mongodb": "^3.5.27",
"@types/node": "^14.11.2",
"@types/react": "^16.9.49",

4
release.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = async (markdown, metaData) => {
console.log(metaData);
return markdown;
};

View File

@@ -25,7 +25,7 @@ const base = {
'https://github.githubassets.com/images/modules/open_graph/github-mark.png',
color: '#128377'
},
core: { secret: 'my-secret', port: 3000 },
core: { secret: 'my-secret', port: 3000, host: '127.0.0.1', theme: 'dark', secure: false },
uploader: {
directory: './uploads',
route: '/u',

View File

@@ -34,13 +34,14 @@ export default function ManageUser() {
const [alertOpen, setAlertOpen] = useState(false);
const [username, setUsername] = useState(state.user.username);
const [password, setPassword] = useState('');
const [email, setEmail] = useState('');
const handleUpdateUser = async () => {
const d = await (
await fetch('/api/user', {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ username, password })
body: JSON.stringify({ username, password: password.trim() === '' ? null : password, email })
})
).json();
if (!d.error) {
@@ -82,6 +83,14 @@ export default function ManageUser() {
className={classes.field}
onChange={e => setPassword(e.target.value)}
/>
<TextField
label='Email'
type='email'
helperText='Used for a Gravatar Avatar'
value={email}
className={classes.field}
onChange={e => setEmail(e.target.value)}
/>
</CardContent>
<CardActions>
<Button

View File

@@ -5,6 +5,7 @@ import Box from '@material-ui/core/Box';
import Menu from '@material-ui/core/Menu';
import MenuItem from '@material-ui/core/MenuItem';
import Drawer from '@material-ui/core/Drawer';
import Avatar from '@material-ui/core/Avatar';
import Hidden from '@material-ui/core/Hidden';
import List from '@material-ui/core/List';
import ListItem from '@material-ui/core/ListItem';
@@ -39,6 +40,7 @@ import { makeStyles, useTheme, withStyles } from '@material-ui/core/styles';
import { useRouter } from 'next/router';
import { useDispatch } from 'react-redux';
import { store } from '../store';
import { MD5 } from 'crypto-js';
const drawerWidth = 240;
@@ -101,6 +103,7 @@ export default function UI({ children }) {
const state = store.getState();
const router = useRouter();
const dispatch = useDispatch();
const [emailHash, setEmailHash] = useState('');
const [mobileOpen, setMobileOpen] = useState(false);
const [admin, setAdmin] = useState(false);
const [anchorEl, setAnchorEl] = useState(null);
@@ -119,6 +122,8 @@ export default function UI({ children }) {
router.push('/user/login');
} else setAdmin(d.administrator);
})();
setEmailHash(MD5(state.user.email).toString());
}, []);
const handleCopyTokenThenClose = async () => {
@@ -174,16 +179,31 @@ export default function UI({ children }) {
</IconButton>
<Typography variant='h6'>Zipline</Typography>
<Box className={classes.rightButton}>
<IconButton
aria-label='account of current user'
aria-controls='menu-appbar'
aria-haspopup='true'
onClick={event => setAnchorEl(event.currentTarget)}
color='inherit'
className={classes.rightButton}
>
<AccountCircleIcon className={classes.rightButton} />
</IconButton>
{state.user.email ? (
<Button
aria-label='account of current user'
aria-controls='menu-appbar'
aria-haspopup='true'
onClick={event => setAnchorEl(event.currentTarget)}
color='inherit'
className={classes.rightButton}
>
<Avatar src={`https://www.gravatar.com/avatar/${emailHash}.jpg`}>
{state.user.username[0].toUpperCase()}
</Avatar>
</Button>
) : (
<IconButton
aria-label='account of current user'
aria-controls='menu-appbar'
aria-haspopup='true'
onClick={event => setAnchorEl(event.currentTarget)}
color='inherit'
className={classes.rightButton}
>
<AccountCircleIcon className={classes.rightButton} />
</IconButton>
)}
</Box>
<Menu

View File

@@ -63,7 +63,7 @@ export class UserController {
@PATCH('/')
async editUser(
req: FastifyRequest<{ Body: { username: string; password: string } }>,
req: FastifyRequest<{ Body: { username: string; password: string, email: string; } }>,
reply: FastifyReply
) {
if (!req.cookies.zipline) throw new LoginError('Not logged in.');
@@ -78,7 +78,8 @@ export class UserController {
this.logger.verbose(`attempting to save ${user.username} (${user.id})`);
user.username = req.body.username;
user.password = encryptPassword(req.body.password);
if (req.body.password) user.password = encryptPassword(req.body.password);
if (req.body.email) user.email = req.body.email;
await this.users.save(user);
this.logger.info(`saved ${user.username} (${user.id})`);

View File

@@ -11,6 +11,9 @@ export class User {
@Column('text')
public password: string;
@Column('text', { default: null }) /* used for gravatar avatar! */
public email: string;
@Column('boolean', { default: false })
public administrator: boolean;
@@ -25,6 +28,7 @@ export class User {
) {
this.username = username;
this.password = password;
this.email = null;
this.administrator = administrator;
this.token = token;
}

View File

@@ -11,7 +11,6 @@ import { bootstrap } from 'fastify-decorators';
import { Console } from './lib/logger';
import { AddressInfo } from 'net';
import { magenta, bold, green, reset, blue, red } from '@dicedtomato/colors';
import Redis from 'ioredis';
import { Configuration } from './lib/Config';
import { UserController } from './controllers/UserController';
import { RootController } from './controllers/RootController';
@@ -160,7 +159,6 @@ server.listen({
});
server.addHook('preHandler', async (req, reply) => {
if (
config.core.blacklisted_ips &&
config.core.blacklisted_ips.includes(req.ip)

View File

@@ -1293,13 +1293,6 @@
"@types/react" "*"
hoist-non-react-statics "^3.3.0"
"@types/ioredis@^4.17.7":
version "4.17.7"
resolved "https://registry.yarnpkg.com/@types/ioredis/-/ioredis-4.17.7.tgz#5007a56380fd387315efabc6c777c050feabb121"
integrity sha512-M8/KDSGmNYhPFMn+CxDDpIEHP27b2muEHgnK1UgIQIMEO2KXH9mznHx3epeRlD+AjF94HFh3dy2/9zqO+pPDqQ==
dependencies:
"@types/node" "*"
"@types/json-schema@^7.0.3", "@types/json-schema@^7.0.5":
version "7.0.6"
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.6.tgz#f4c7ec43e81b319a9815115031709f26987891f0"
@@ -2436,11 +2429,6 @@ clsx@^1.0.2, clsx@^1.0.4, clsx@^1.1.1:
resolved "https://registry.yarnpkg.com/clsx/-/clsx-1.1.1.tgz#98b3134f9abbdf23b2663491ace13c5c03a73188"
integrity sha512-6/bPho624p3S2pMyvP5kKBPXnI3ufHLObBFCfgx+LkeR5lg2XYy2hqZqUf45ypD8COn2bhgGJSUE+l5dhNBieA==
cluster-key-slot@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/cluster-key-slot/-/cluster-key-slot-1.1.0.tgz#30474b2a981fb12172695833052bc0d01336d10d"
integrity sha512-2Nii8p3RwAPiFwsnZvukotvow2rIHM+yQ6ZcBXGHdniadkYGZYiGmkHJIbZPIV9nfv7m/U1IPMVVcAhoWFeklw==
code-point-at@^1.0.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77"
@@ -2852,7 +2840,7 @@ delegates@^1.0.0:
resolved "https://registry.yarnpkg.com/delegates/-/delegates-1.0.0.tgz#84c6e159b81904fdca59a0ef44cd870d31250f9a"
integrity sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=
denque@^1.1.0, denque@^1.4.1:
denque@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/denque/-/denque-1.4.1.tgz#6744ff7641c148c3f8a69c307e51235c1f4a37cf"
integrity sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ==
@@ -4161,22 +4149,6 @@ invariant@^2.2.2:
dependencies:
loose-envify "^1.0.0"
ioredis@^4.19.2:
version "4.19.2"
resolved "https://registry.yarnpkg.com/ioredis/-/ioredis-4.19.2.tgz#e3eab394c653cea5aea07c0c784d8c772dce8801"
integrity sha512-SZSIwMrbd96b7rJvJwyTWSP6XQ0m1kAIIqBnwglJKrIJ6na7TeY4F2EV2vDY0xm/fLrUY8cEg81dR7kVFt2sKA==
dependencies:
cluster-key-slot "^1.1.0"
debug "^4.1.1"
denque "^1.1.0"
lodash.defaults "^4.2.0"
lodash.flatten "^4.4.0"
p-map "^2.1.0"
redis-commands "1.6.0"
redis-errors "^1.2.0"
redis-parser "^3.0.0"
standard-as-callback "^2.0.1"
ipaddr.js@1.9.1:
version "1.9.1"
resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.9.1.tgz#bff38543eeb8984825079ff3a2a8e6cbd46781b3"
@@ -4637,16 +4609,6 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
lodash.defaults@^4.2.0:
version "4.2.0"
resolved "https://registry.yarnpkg.com/lodash.defaults/-/lodash.defaults-4.2.0.tgz#d09178716ffea4dde9e5fb7b37f6f0802274580c"
integrity sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=
lodash.flatten@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/lodash.flatten/-/lodash.flatten-4.4.0.tgz#f31c22225a9632d2bbf8e4addbef240aa765a61f"
integrity sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=
lodash.sortby@^4.7.0:
version "4.7.0"
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
@@ -5390,11 +5352,6 @@ p-locate@^4.1.0:
dependencies:
p-limit "^2.2.0"
p-map@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-2.1.0.tgz#310928feef9c9ecc65b68b17693018a665cea175"
integrity sha512-y3b8Kpd8OAN444hxfBbFfj1FY/RjtTd8tzYwhUqNYXx0fXx2iX4maP4Qr6qhIKbQXI02wTLAda4fYUbDagTUFw==
p-map@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/p-map/-/p-map-4.0.0.tgz#bb2f95a5eda2ec168ec9274e06a747c3e2904d2b"
@@ -6011,23 +5968,6 @@ readdirp@~3.5.0:
dependencies:
picomatch "^2.2.1"
redis-commands@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/redis-commands/-/redis-commands-1.6.0.tgz#36d4ca42ae9ed29815cdb30ad9f97982eba1ce23"
integrity sha512-2jnZ0IkjZxvguITjFTrGiLyzQZcTvaw8DAaCXxZq/dsHXz7KfMQ3OUJy7Tz9vnRtZRVz6VRCPDvruvU8Ts44wQ==
redis-errors@^1.0.0, redis-errors@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/redis-errors/-/redis-errors-1.2.0.tgz#eb62d2adb15e4eaf4610c04afe1529384250abad"
integrity sha1-62LSrbFeTq9GEMBK/hUpOEJQq60=
redis-parser@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/redis-parser/-/redis-parser-3.0.0.tgz#b66d828cdcafe6b4b8a428a7def4c6bcac31c8b4"
integrity sha1-tm2CjNyv5rS4pCin3vTGvKwxyLQ=
dependencies:
redis-errors "^1.0.0"
redux-persist@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/redux-persist/-/redux-persist-6.0.0.tgz#b4d2972f9859597c130d40d4b146fecdab51b3a8"
@@ -6638,11 +6578,6 @@ stacktrace-parser@0.1.10:
dependencies:
type-fest "^0.7.1"
standard-as-callback@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/standard-as-callback/-/standard-as-callback-2.0.1.tgz#ed8bb25648e15831759b6023bdb87e6b60b38126"
integrity sha512-NQOxSeB8gOI5WjSaxjBgog2QFw55FV8TkS6Y07BiB3VJ8xNTvUYm0wl0s8ObgQ5NhdpnNfigMIKjgPESzgr4tg==
static-extend@^0.1.1:
version "0.1.2"
resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6"