mirror of
https://github.com/seejohnrun/haste-server.git
synced 2024-11-22 20:51:21 +00:00
add relative paths
This commit is contained in:
parent
ab47249505
commit
21aa23dd28
26 changed files with 71 additions and 67 deletions
14
README.md
14
README.md
|
@ -123,7 +123,7 @@ File storage currently does not support paste expiration, you can follow [#191](
|
|||
To use redis storage you must install the `redis` package in npm, and have
|
||||
`redis-server` running on the machine.
|
||||
|
||||
`npm install redis`
|
||||
`yarn install redis`
|
||||
|
||||
Once you've done that, your config section should look like:
|
||||
|
||||
|
@ -148,7 +148,7 @@ If your Redis server is configured for password authentification, use the `passw
|
|||
|
||||
To use postgres storage you must install the `pg` package in npm
|
||||
|
||||
`npm install pg`
|
||||
`yarn install pg`
|
||||
|
||||
Once you've done that, your config section should look like:
|
||||
|
||||
|
@ -175,7 +175,7 @@ All of which are optional except `type` with very logical default values.
|
|||
|
||||
To use mongodb storage you must install the 'mongodb' package in npm
|
||||
|
||||
`npm install mongodb`
|
||||
`yarn install mongodb`
|
||||
|
||||
Once you've done that, your config section should look like:
|
||||
|
||||
|
@ -197,7 +197,7 @@ This is off by default, but will constantly kick back expirations on each view o
|
|||
|
||||
To use memcache storage you must install the `memcached` package via npm
|
||||
|
||||
`npm install memcached`
|
||||
`yarn install memcached`
|
||||
|
||||
Once you've done that, your config section should look like:
|
||||
|
||||
|
@ -219,7 +219,7 @@ All of which are optional except `type` with very logical default values.
|
|||
|
||||
To use the RethinkDB storage system, you must install the `rethinkdbdash` package via npm
|
||||
|
||||
`npm install rethinkdbdash`
|
||||
`yarn install rethinkdbdash`
|
||||
|
||||
Once you've done that, your config section should look like this:
|
||||
|
||||
|
@ -241,7 +241,7 @@ You can optionally add the `user` and `password` properties to use a user system
|
|||
|
||||
To use the Google Datastore storage system, you must install the `@google-cloud/datastore` package via npm
|
||||
|
||||
`npm install @google-cloud/datastore`
|
||||
`yarn install @google-cloud/datastore`
|
||||
|
||||
Once you've done that, your config section should look like this:
|
||||
|
||||
|
@ -258,7 +258,7 @@ Authentication is handled automatically by [Google Cloud service account credent
|
|||
To use [Amazon S3](https://aws.amazon.com/s3/) as a storage system, you must
|
||||
install the `aws-sdk` package via npm:
|
||||
|
||||
`npm install aws-sdk`
|
||||
`yarn install aws-sdk`
|
||||
|
||||
Once you've done that, your config section should look like this:
|
||||
|
||||
|
|
|
@ -4,5 +4,11 @@ module.exports = {
|
|||
testEnvironment: 'node',
|
||||
rootDir: '../',
|
||||
testRegex: '\\.test\\.ts$',
|
||||
reporters: ['default']
|
||||
reporters: ['default'],
|
||||
roots: [
|
||||
"test"
|
||||
],
|
||||
moduleNameMapper: {
|
||||
"src/(.*)": "<rootDir>/src/$1"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Config } from '../../types/config'
|
||||
import buildGenerator from '../key-generators/builder'
|
||||
import buildStore from '../document-stores/builder'
|
||||
import buildGenerator from 'src/lib/key-generators/builder'
|
||||
import type { Config } from 'src/types/config'
|
||||
import buildStore from 'src/lib/document-stores/builder'
|
||||
import DocumentHandler from "./index"
|
||||
|
||||
const build = async (config: Config) => {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { Request, Response } from 'express'
|
||||
import * as winston from 'winston'
|
||||
import Busboy from 'busboy'
|
||||
import type { Config } from '../../types/config'
|
||||
import type { Store } from '../../types/store'
|
||||
import type { KeyGenerator } from '../../types/key-generator'
|
||||
import type { Document } from '../../types/document'
|
||||
import constants from '../../constants'
|
||||
import type { Config } from 'src/types/config'
|
||||
import type { Store } from 'src/types/store'
|
||||
import type { KeyGenerator } from 'src/types/key-generator'
|
||||
import type { Document } from 'src/types/document'
|
||||
import constants from 'src/constants'
|
||||
|
||||
class DocumentHandler {
|
||||
keyLength: number
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as winston from 'winston'
|
||||
import AWS from 'aws-sdk'
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { AmazonStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { AmazonStoreConfig } from 'src/types/config'
|
||||
|
||||
class AmazonS3DocumentStore implements Store {
|
||||
bucket: string | undefined
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { Config } from '../../types/config'
|
||||
import type { Store } from '../../types/store'
|
||||
import type { Config } from 'src/types/config'
|
||||
import type { Store } from 'src/types/store'
|
||||
|
||||
const build = async (config: Config): Promise<Store> => {
|
||||
const DocumentStore = (
|
||||
|
|
|
@ -2,8 +2,8 @@ import * as winston from 'winston'
|
|||
import * as fs from 'fs'
|
||||
import * as crypto from 'crypto'
|
||||
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { FileStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { FileStoreConfig } from 'src/types/config'
|
||||
|
||||
// Generate md5 of a string
|
||||
const md5 = (str: string) => {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { Datastore, PathType } from '@google-cloud/datastore'
|
||||
import * as winston from 'winston'
|
||||
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { GoogleStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { GoogleStoreConfig } from 'src/types/config'
|
||||
|
||||
class GoogleDatastoreDocumentStore implements Store {
|
||||
kind: string
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as winston from 'winston'
|
||||
import Memcached = require('memcached')
|
||||
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { MemcachedStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { MemcachedStoreConfig } from 'src/types/config'
|
||||
|
||||
class MemcachedDocumentStore implements Store {
|
||||
expire: number | undefined
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as winston from 'winston'
|
||||
import { MongoClient } from 'mongodb'
|
||||
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { MongoStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { MongoStoreConfig } from 'src/types/config'
|
||||
|
||||
type ConnectCallback = (error?: Error, db?: MongoClient) => void
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as winston from 'winston'
|
||||
import { Pool, PoolClient } from 'pg'
|
||||
|
||||
import type { Callback, Store } from '../../types/store'
|
||||
import type { PostgresStoreConfig } from '../../types/config'
|
||||
import type { Callback, Store } from 'src/types/store'
|
||||
import type { PostgresStoreConfig } from 'src/types/config'
|
||||
|
||||
type ConnectCallback = (
|
||||
error?: Error,
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as winston from 'winston'
|
||||
import { createClient } from 'redis'
|
||||
import { bool } from 'aws-sdk/clients/redshiftdata'
|
||||
import { Callback, Store } from '../../types/store'
|
||||
import { RedisStoreConfig } from '../../types/config'
|
||||
import { Callback, Store } from 'src/types/store'
|
||||
import { RedisStoreConfig } from 'src/types/config'
|
||||
|
||||
export type RedisClientType = ReturnType<typeof createClient>
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ import * as crypto from 'crypto'
|
|||
|
||||
import rethink, { RethinkClient } from 'rethinkdbdash'
|
||||
|
||||
import type { RethinkDbStoreConfig } from '../../types/config'
|
||||
import type { Callback } from '../../types/store'
|
||||
import type { RethinkDbStoreConfig } from 'src/types/config'
|
||||
import type { Callback } from 'src/types/store'
|
||||
|
||||
const md5 = (str: string) => {
|
||||
const md5sum = crypto.createHash('md5')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as fs from 'fs'
|
||||
import * as path from 'path'
|
||||
|
||||
import { Config } from '../../types/config'
|
||||
import { Config } from 'src/types/config'
|
||||
|
||||
const getConfig = (): Config => {
|
||||
const configPath =
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import * as winston from 'winston'
|
||||
import type { Config } from '../../types/config'
|
||||
import type { Config } from 'src/types/config'
|
||||
|
||||
const addLogging = (config: Config) => {
|
||||
try {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { KeyGenerator } from '../../types/key-generator'
|
||||
import type { Config } from '../../types/config'
|
||||
import type { KeyGenerator } from 'src/types/key-generator'
|
||||
import type { Config } from 'src/types/config'
|
||||
|
||||
const build = async (config: Config): Promise<KeyGenerator> => {
|
||||
const pwOptions = config.keyGenerator
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as fs from 'fs'
|
||||
import type { KeyGeneratorConfig } from '../../types/config'
|
||||
import type { KeyGenerator } from '../../types/key-generator'
|
||||
import type { KeyGeneratorConfig } from 'src/types/config'
|
||||
import type { KeyGenerator } from 'src/types/key-generator'
|
||||
|
||||
class DictionaryGenerator implements KeyGenerator {
|
||||
type: string
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Draws inspiration from pwgen and http://tools.arantius.com/password
|
||||
|
||||
import type { KeyGeneratorConfig } from '../../types/config'
|
||||
import type { KeyGenerator } from '../../types/key-generator'
|
||||
import type { KeyGeneratorConfig } from 'src/types/config'
|
||||
import type { KeyGenerator } from 'src/types/key-generator'
|
||||
|
||||
const randOf = (collection: string) => () =>
|
||||
collection[Math.floor(Math.random() * collection.length)]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { KeyGeneratorConfig } from '../../types/config'
|
||||
import type { KeyGenerator } from '../../types/key-generator'
|
||||
import type { KeyGeneratorConfig } from 'src/types/config'
|
||||
import type { KeyGenerator } from 'src/types/key-generator'
|
||||
|
||||
class RandomKeyGenerator implements KeyGenerator {
|
||||
type: string
|
||||
|
|
|
@ -4,15 +4,15 @@ import * as winston from 'winston'
|
|||
import uglify from 'uglify-js'
|
||||
import connectSt from 'st'
|
||||
import connectRateLimit from 'connect-ratelimit'
|
||||
import getConfig from './lib/helpers/config'
|
||||
import addLogging from './lib/helpers/log'
|
||||
import buildDocumenthandler from './lib/document-handler/builder'
|
||||
import DocumentHandler from './lib/document-handler'
|
||||
import { Config } from './types/config'
|
||||
import { Config } from 'src/types/config'
|
||||
import getConfig from 'src/lib/helpers/config'
|
||||
import addLogging from 'src/lib/helpers/log'
|
||||
import DocumentHandler from 'src/lib/document-handler'
|
||||
import buildDocumenthandler from 'src/lib/document-handler/builder'
|
||||
import {
|
||||
getStaticDirectory,
|
||||
getStaticItemDirectory,
|
||||
} from './lib/helpers/directory'
|
||||
} from 'src/lib/helpers/directory'
|
||||
|
||||
const config: Config = getConfig()
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { createMock } from 'ts-auto-mock';
|
||||
import DocumentHandler from '../../src/lib/document-handler/index'
|
||||
import Generator from '../../src/lib/key-generators/random'
|
||||
import constants from '../../src/constants'
|
||||
import { Store } from '../../src/types/store'
|
||||
import { Config } from '../../src/types/config'
|
||||
import DocumentHandler from 'src/lib/document-handler/index'
|
||||
import Generator from 'src/lib/key-generators/random'
|
||||
import constants from 'src/constants'
|
||||
import { Store } from 'src/types/store'
|
||||
import { Config } from 'src/types/config'
|
||||
|
||||
const store : Store = createMock<Store>();
|
||||
const config : Config = createMock<Config>();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import RedisDocumentStore from '../../src/lib/document-stores/redis'
|
||||
import RedisDocumentStore from 'src/lib/document-stores/redis'
|
||||
|
||||
describe('Redis document store', () => {
|
||||
let store: RedisDocumentStore
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import Generator from '../../src/lib/key-generators/dictionary'
|
||||
import Generator from 'src/lib/key-generators/dictionary'
|
||||
|
||||
jest.mock('fs', () => ({
|
||||
readFile: jest.fn().mockImplementation((_, a, callback) =>
|
||||
callback(null, 'cat'),
|
||||
)
|
||||
readFile: jest
|
||||
.fn()
|
||||
.mockImplementation((_, a, callback) => callback(null, 'cat'))
|
||||
}))
|
||||
|
||||
describe('DictionaryGenerator', () => {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable jest/no-conditional-expect */
|
||||
import Generator from '../../src/lib/key-generators/phonetic'
|
||||
import Generator from 'src/lib/key-generators/phonetic'
|
||||
|
||||
const vowels = 'aeiou';
|
||||
const consonants = 'bcdfghjklmnpqrstvwxyz';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import Generator from '../../src/lib/key-generators/random'
|
||||
import Generator from 'src/lib/key-generators/random'
|
||||
|
||||
describe('RandomKeyGenerator', () => {
|
||||
describe('generation', () => {
|
||||
|
|
|
@ -28,9 +28,7 @@
|
|||
"sourceMap": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"paths": {
|
||||
"~/*": ["/src/*"]
|
||||
}
|
||||
"baseUrl": ".",
|
||||
},
|
||||
"include": ["src", "**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
|
|
Loading…
Reference in a new issue