-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
36 changed files
with
2,339 additions
and
2,968 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
# Misskey configuration | ||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
# ┌───────────────────────┐ | ||
#───┘ Port settings └─────────────────────────────────── | ||
|
||
# Listen port | ||
port: 3000 | ||
|
||
# ┌─────────────────────┐ | ||
#───┘ Other configuration └───────────────────────────────────── | ||
|
||
# Proxy for HTTP/HTTPS | ||
#proxy: http://127.0.0.1:3128 | ||
|
||
#allowedPrivateNetworks: [ | ||
# '127.0.0.1/32' | ||
#] | ||
|
||
# Download file size limits (bytes) | ||
#maxFileSize: 262144000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
# Misskey configuration | ||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ | ||
|
||
# ┌───────────────────────┐ | ||
#───┘ Port settings └─────────────────────────────────── | ||
|
||
# Listen port | ||
port: 3000 | ||
|
||
# ┌─────────────────────┐ | ||
#───┘ Other configuration └───────────────────────────────────── | ||
|
||
# Proxy for HTTP/HTTPS | ||
#proxy: http://127.0.0.1:3128 | ||
|
||
#allowedPrivateNetworks: [ | ||
# '127.0.0.1/32' | ||
#] | ||
|
||
# Download file size limits (bytes) | ||
#maxFileSize: 262144000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
declare const _default: import("./types.js").Source & import("./types.js").Mixin; | ||
export default _default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import load from './load.js'; | ||
export default load(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Config loader | ||
*/ | ||
import { Source, Mixin } from './types.js'; | ||
export default function load(): Source & Mixin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Config loader | ||
*/ | ||
import * as fs from 'node:fs'; | ||
import { fileURLToPath } from 'node:url'; | ||
import { dirname } from 'node:path'; | ||
import * as yaml from 'js-yaml'; | ||
const _filename = fileURLToPath(import.meta.url); | ||
const _dirname = dirname(_filename); | ||
/** | ||
* Path of configuration directory | ||
*/ | ||
const dir = `${_dirname}/../../.config`; | ||
/** | ||
* Path of configuration file | ||
*/ | ||
const path = process.env.NODE_ENV === 'test' | ||
? `${dir}/test.yml` | ||
: `${dir}/default.yml`; | ||
const verDir = `${_dirname}/../..`; | ||
const verPath = `${verDir}/package.json`; | ||
export default function load() { | ||
const repo = JSON.parse(fs.readFileSync(verPath, 'utf8')); | ||
const config = yaml.load(fs.readFileSync(path, 'utf-8')); | ||
const mixin = {}; | ||
mixin.userAgent = `MisskeyMediaProxy/${repo.version}`; | ||
return Object.assign(config, mixin); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* ユーザーが設定する必要のある情報 | ||
*/ | ||
export type Source = { | ||
port?: number; | ||
proxy?: string; | ||
maxFileSize?: number; | ||
allowedPrivateNetworks?: string[]; | ||
}; | ||
/** | ||
* Misskeyが自動的に(ユーザーが設定した情報から推論して)設定する情報 | ||
*/ | ||
export type Mixin = { | ||
userAgent: string; | ||
}; | ||
export type Config = Source & Mixin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,3 @@ | ||
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import * as http from 'node:http'; | ||
import * as https from 'node:https'; | ||
export type DownloadConfig = { | ||
[x: string]: any; | ||
userAgent: string; | ||
allowedPrivateNetworks: string[]; | ||
maxSize: number; | ||
httpAgent: http.Agent; | ||
httpsAgent: https.Agent; | ||
proxy?: boolean; | ||
}; | ||
export declare const defaultDownloadConfig: { | ||
httpAgent: http.Agent; | ||
httpsAgent: https.Agent; | ||
userAgent: string; | ||
allowedPrivateNetworks: never[]; | ||
maxSize: number; | ||
proxy: boolean; | ||
}; | ||
export declare function downloadUrl(url: string, path: string, settings?: DownloadConfig): Promise<{ | ||
export declare function downloadUrl(url: string, path: string): Promise<{ | ||
filename: string; | ||
}>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.