Skip to content

Commit

Permalink
完整提交
Browse files Browse the repository at this point in the history
  • Loading branch information
uxiaohan committed Jul 22, 2024
1 parent c0594a5 commit cce7d62
Show file tree
Hide file tree
Showing 34 changed files with 7,863 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_IMG_API_URL = 'https://wp-cdn.4ce.cn/upload'
1 change: 1 addition & 0 deletions .env.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_IMG_API_URL = '/upload'
15 changes: 15 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
'extends': [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-typescript',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
.DS_Store
dist
.wrangler
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"tabWidth": 2,
"singleQuote": true,
"printWidth": 566,
"trailingComma": "none"
}
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,39 @@
# ZYCS-IMG
骤雨重山图床
# 骤雨重山图床Web

This template should help get you started developing with Vue 3 in Vite.

## Recommended IDE Setup

[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur).

## Type Support for `.vue` Imports in TS

TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) to make the TypeScript language service aware of `.vue` types.

## Customize configuration

See [Vite Configuration Reference](https://vitejs.dev/config/).

## Project Setup

```sh
npm install
```

### Compile and Hot-Reload for Development

```sh
npm run dev
```

### Type-Check, Compile and Minify for Production

```sh
npm run build
```

### Lint with [ESLint](https://eslint.org/)

```sh
npm run lint
```
1 change: 1 addition & 0 deletions env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
5 changes: 5 additions & 0 deletions functions/telegraproxy/[vkey].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export async function onRequestGet({ request }) {
const { url, method, headers, body } = request;
const newUrl = new URL(url);
return fetch(`https://telegra.ph${newUrl.pathname.replace('telegraproxy', 'file')}`, { method, headers, body });
}
15 changes: 15 additions & 0 deletions functions/upload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export async function onRequest({ request }) {
const { url, method, headers, body } = request;
const newUrl = new URL(url);
const res = await fetch('https://telegra.ph' + newUrl.pathname + newUrl.search, { method, headers, body });
const resText = await res.text();
let ResUrl = '';
try {
ResUrl = `https://${newUrl.hostname}/v2/${JSON.parse(resText)[0].src.replace('/file/', '')}`;
} catch (error) {
ResUrl = 'Failed';
}
const newRes = new Response(ResUrl);
newRes.headers.set('Access-Control-Allow-Origin', '*');
return newRes;
}
12 changes: 12 additions & 0 deletions functions/v2/[vkey].js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export async function onRequestGet({ request }) {
const { url, method, headers, body } = request;
const newUrl = new URL(url);
return fetch(
`https://i${Math.floor(Math.random() * 4)}.wp.com/${newUrl.hostname}${newUrl.pathname.replace('v2', 'telegraproxy')}${newUrl.search}`,
{
method,
headers,
body,
},
);
}
22 changes: 22 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no" />
<title>骤雨重山图床</title>
<meta name="keywords" content="骤雨重山图床" />
<meta name="description" content="骤雨重山图床" />
<meta property="og:description" content="骤雨重山图床" />
<meta property="og:site_name" content="骤雨重山图床" />
<meta property="og:title" content="骤雨重山图床" />
<meta property="og:url" content="https://wp-cdn.4ce.cn" />
<meta itemprop="image" content="favicon.ico" />
<link rel="icon" href="favicon.ico" />
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>
Loading

0 comments on commit cce7d62

Please sign in to comment.