Skip to content
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.

Put part of the config in the Vercel Environment Variable, which simplifies the deployment process #1048

Open
wants to merge 95 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
8ffb9ee
Modified to a One-Click Deploy Version
Jun 22, 2023
fc39405
Update README.md
Jun 22, 2023
5705876
Update api.config.js
Jun 22, 2023
345a2d8
Update Navbar.tsx
Jun 22, 2023
708a782
Create vercel.json
Jun 22, 2023
a0cf206
Merge branch 'spencerwooo:main' into main
iRedScarf Jun 25, 2023
01ca151
update README
Jun 25, 2023
2c35eaf
update README
Jun 26, 2023
f330390
Update site.config.js
Jun 26, 2023
2350d03
update
ailoha Jun 29, 2023
3236a5b
Merge pull request #1 from ailoha/main
iRedScarf Jun 29, 2023
f3f5704
Update site.config.js
iRedScarf Jun 29, 2023
80c049b
Update site.config.js
iRedScarf Jun 29, 2023
a046a0f
Update README.zh-CN.md
iRedScarf Jun 29, 2023
5ae4d8c
更新 README.zh-CN.md
iRedScarf Jun 29, 2023
ad7dd54
Update README.zh-CN.md
iRedScarf Jun 29, 2023
9072676
Update README.md
iRedScarf Jun 29, 2023
a662817
Update step-1.tsx
ailoha Jun 30, 2023
44f6ff7
Merge pull request #2 from ailoha/main
iRedScarf Jun 30, 2023
d28b7f8
Update README.zh-CN.md
iRedScarf Jun 30, 2023
3cfd03d
Update README.md
iRedScarf Jun 30, 2023
727be25
Update README.zh-CN.md
iRedScarf Jun 30, 2023
bae3360
Update README.md
iRedScarf Jun 30, 2023
2b33726
更新 step-1.tsx
iRedScarf Jun 30, 2023
48b310f
更新 step-2.tsx
iRedScarf Jun 30, 2023
9131979
更新 README.zh-CN.md
iRedScarf Jun 30, 2023
f712c00
更新 README.md
iRedScarf Jun 30, 2023
e33b44b
Update README.zh-CN.md
iRedScarf Jun 30, 2023
bac902a
更新 step-3.tsx
iRedScarf Jul 3, 2023
f46e6db
Update site.config.js
iRedScarf Jul 4, 2023
9359251
Modifications
Jul 5, 2023
b4cf4b4
Update README.zh-CN.md
Jul 5, 2023
6fd42e4
Update oAuthHandler.ts
Jul 5, 2023
2552088
update
Jul 6, 2023
d819357
update
Jul 7, 2023
839eae9
Update step-3.tsx
Jul 7, 2023
083fdbb
rollback
Jul 7, 2023
71a8a83
bug fixed
Jul 7, 2023
50cad7c
Update step-3.tsx
Jul 7, 2023
0cd256d
Update site.config.js
iRedScarf Jul 7, 2023
b51ea21
Update site.config.js
iRedScarf Jul 7, 2023
a9d9979
更新 README.zh-CN.md
iRedScarf Jul 7, 2023
0047ad2
Update README.zh-CN.md
iRedScarf Jul 7, 2023
1c63336
Update README.zh-CN.md
iRedScarf Jul 7, 2023
7d0147b
Update README.zh-CN.md
iRedScarf Jul 7, 2023
bab02d7
Update README.zh-CN.md
iRedScarf Jul 7, 2023
2d545f3
Update README.zh-CN.md
iRedScarf Jul 7, 2023
a2c7ce0
Update README.md
iRedScarf Jul 7, 2023
3162da4
Update README.zh-CN.md
iRedScarf Jul 7, 2023
65eb790
Update site.config.js
iRedScarf Jul 7, 2023
d939cf0
Update README.zh-CN.md
ailoha Jul 7, 2023
2684e85
Update README.md
ailoha Jul 8, 2023
4f19bea
Update README.zh-CN.md
ailoha Jul 8, 2023
7cfb9ad
Update README.md
ailoha Jul 8, 2023
adebb66
feat: fetch title for page rendring
therockstarind Jul 9, 2023
238fb9e
Merge pull request #6 from ailoha/main
iRedScarf Jul 9, 2023
d28c5ae
Merge pull request #4 from therockstarind/Title
iRedScarf Jul 10, 2023
9aacdc5
update README
Jul 10, 2023
0f53ec1
Update README.md
iRedScarf Jul 10, 2023
aae806a
Add files via upload
ailoha Jul 10, 2023
a8cb465
Add files via upload
ailoha Jul 10, 2023
38855c3
Add files via upload
ailoha Jul 10, 2023
766b6bb
Merge pull request #7 from ailoha/main
iRedScarf Jul 10, 2023
13cda01
Create TEST-BUTTON.md
ailoha Jul 10, 2023
4898028
Update api.config.js
ailoha Jul 10, 2023
3ce5328
Update site.config.js
ailoha Jul 10, 2023
f320203
Update api.config.js
ailoha Jul 10, 2023
76346e1
Update index.ts
ailoha Jul 10, 2023
4ad08f1
Create config.ts
ailoha Jul 10, 2023
70d05a5
Update TEST-BUTTON.md
ailoha Jul 10, 2023
b761a0c
Update oAuthHandler.ts
ailoha Jul 10, 2023
4697b44
Update step-1.tsx
ailoha Jul 10, 2023
10e7819
Update step-2.tsx
ailoha Jul 10, 2023
de67889
Update step-3.tsx
ailoha Jul 10, 2023
dbddace
Update api.config.js
ailoha Jul 10, 2023
028bd1a
Update step-1.tsx
ailoha Jul 10, 2023
e1df3de
Update step-3.tsx
ailoha Jul 10, 2023
1b48fda
Update index.ts
ailoha Jul 11, 2023
7485dca
Update oAuthHandler.ts
ailoha Jul 11, 2023
b5fa557
Update oAuthHandler.ts
ailoha Jul 11, 2023
4eb8621
Update oAuthHandler.ts
ailoha Jul 11, 2023
25a73cc
Update oAuthHandler.ts
ailoha Jul 11, 2023
29f812a
Update oAuthHandler.ts
ailoha Jul 11, 2023
8f9a294
Update oAuthHandler.ts
ailoha Jul 11, 2023
94cd9d9
Update oAuthHandler.ts
ailoha Jul 11, 2023
c7c163f
update
ailoha Jul 12, 2023
8df36a7
Update step-3.tsx
ailoha Jul 12, 2023
6a838f4
Update step-3.tsx
ailoha Jul 12, 2023
3296d66
Update step-3.tsx
ailoha Jul 12, 2023
5f06ef7
Update TEST-BUTTON.md
ailoha Jul 12, 2023
46a64c5
Delete TEST-BUTTON.md
ailoha Jul 12, 2023
4e14505
update README
ailoha Jul 12, 2023
53039eb
Merge pull request #8 from ailoha/main
iRedScarf Jul 12, 2023
f54ca5d
Refactor code and update comments for clarity
iRedScarf Jul 13, 2023
fea945e
update README
iRedScarf Jul 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2021 Spencer Woo
Copyright (c) 2021-2023 Spencer Woo
Copyright (c) 2023 iRedScarf

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
201 changes: 82 additions & 119 deletions README.md

Large diffs are not rendered by default.

112 changes: 112 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# OneDrive-Vercel-Index(一键部署版)

[English](./README.md) | 简体中文

本项目fork自[spencerwooo/onedrive-vercel-index](https://github.com/spencerwooo/onedrive-vercel-index),基于原作者于2023年6月24日归档的版本并进行了一些小修改,让您可以一键部署在完全免费托管的Vercel,在一个网页中展示、分享、预览和下载您的OneDrive文件。具体部署方法请参考下面的说明。

> 本版本只测试通过E5开发者帐户,其他类型的OneDrive帐户有待进一步测试。

## 修改说明

- 本版本主要把原本需要在`config/`目录下的`api.config.js`和`site.config.js`这两个配置文件中设置的一些变量搬到了Vercel的环境变量中进行设置。如此便无须——先fork原仓库——然后手动修改配置文件——再部署,而是可以直接点击本文档中的一键部署按钮,在部署过程中输入环境变量的值,然后完成部署。

> 本版本把一些比较敏感的变量使用了非`NEXT_PUBLIC_`前缀的环境变量进行设置,尽可能让网站浏览者不能轻易获取你的OneDrive帐号、ClientID以及ClientSecret等信息。

- 再就是本版本设定了当完成OAuth认证后,自动关闭OAuth认证通道,以防有心人通过OAuth认证的网址链接就轻易地获取到用户的配置信息。

## 在线预览

本一键部署版的[在线预览](https://odi-demo.freeloop.one) | 原作者提供的[在线预览](https://drive.swo.moe)(已暂停维护)

![demo](./public/demo.png)

## 部署方法

### 前期准备

1. **设置OneDrive帐户的API权限:**

- 本项目是通过调用OneDrive的API来获取文件列表以及下载链接的,所以设置OneDrive帐户的API权限是必须的,获取方法请参考原作者编写的[使用文档](https://ovi.swo.moe/zh/docs/advanced#修改-api-权限)。

> **需要设置的API权限为以下三个:`user.read`、`files.read.all`、`offline_access`。**

2. **准备好在Vercel部署时填写的五个[必要环境变量(点击查看说明)](#必要变量)的值:**

### 部署到Vercel

3. **当您做好准备工作,就可以点击下面的按钮进行部署了:**

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/clone?repository-url=https%3A%2F%2Fgithub.com%2FiRedScarf%2Fonedrive-vercel-index&env=NEXT_PUBLIC_SITE_TITLE,USER_PRINCIPAL_NAME,BASE_DIRECTORY,CLIENT_ID,CLIENT_SECRET)

> - 如果你有需要密码保护的目录:
>
> [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/clone?repository-url=https%3A%2F%2Fgithub.com%2FiRedScarf%2Fonedrive-vercel-index&env=NEXT_PUBLIC_SITE_TITLE,USER_PRINCIPAL_NAME,BASE_DIRECTORY,NEXT_PUBLIC_PROTECTED_ROUTES,CLIENT_ID,CLIENT_SECRET) with `NEXT_PUBLIC_PROTECTED_ROUTES`
>
> - 如果你有多个OneDrive帐户需要使用同一个Redis数据库:
>
> [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/clone?repository-url=https%3A%2F%2Fgithub.com%2FiRedScarf%2Fonedrive-vercel-index&env=NEXT_PUBLIC_SITE_TITLE,USER_PRINCIPAL_NAME,BASE_DIRECTORY,CLIENT_ID,CLIENT_SECRET,KV_PREFIX) with `KV_PREFIX`
>
> - 如果你需要部署多个OneDrive-Index同时都有需要密码保护的目录:
>
> [![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/git/clone?repository-url=https%3A%2F%2Fgithub.com%2FiRedScarf%2Fonedrive-vercel-index&env=NEXT_PUBLIC_SITE_TITLE,USER_PRINCIPAL_NAME,BASE_DIRECTORY,NEXT_PUBLIC_PROTECTED_ROUTES,CLIENT_ID,CLIENT_SECRET,KV_PREFIX) with `NEXT_PUBLIC_PROTECTED_ROUTES` & `KV_PREFIX`

4. **初次部署成功后,部署的页面上去是404的,因为我们还需要连接到Redis数据库。**

> `REDIS_URL`:如果您是第一次接触Redis数据库,那么强烈推荐您使用免费且与Vercel深度合作的Upstash,详细参考[Vercel Integration](https://docs.upstash.com/redis/howto/vercelintegration),按说明在Vercel的[Upstash集成](https://vercel.com/integrations/upstash)中设置好(简单说就是在Upstash的`Redis`选项卡中新建一个数据库,再在`Vercel Integrations`中新建集成,把刚部署的OneDrive-Index项目与Redis数据库进行关联),它会自动填入项目部署后的环境变量中。

5. **`REDIS_URL`设置成功后,再重新部署一次项目。**

6. **部署成功后,当您第一次访问您的`onedrive-vercel-index`页面时,会引导你进行OAuth认证(相当简单),详情请参考原作者编写的[说明文档](https://ovi.swo.moe/zh/docs/getting-started#进行认证)。**

## 环境变量

### 必要变量
| 名称 | 描述 | 原路径 | 说明 |
| --- | --- | --- | --- |
| `NEXT_PUBLIC_SITE_TITLE` | 展示页面的标题 | `config/site.config.js` | 例如:尼加拉瓜首富的OneDrive |
| `USER_PRINCIPAL_NAME` | 您的OneDrive帐户 | `config/site.config.js` | **字母大小写必须一致** |
| `BASE_DIRECTORY` | 您要分享的OneDrive目录 | `config/site.config.js` | (格式为`/目录名`),根目录则填写`/` |
| `CLIENT_ID` | 您在微软Azure注册的应用程序客户端ID | `config/api.config.js` | 原作者提供的已过期,建议自己注册一个,有效期可以设到两年(反正也要设置帐户的API权限,顺道咯)。获取方式参照原作者编写的[使用文档](https://ovi.swo.moe/zh/docs/advanced#使用你自己的-client-id-与-secret) |
| `CLIENT_SECRET` | 您在微软Azure注册的应用程序客户端密钥 | `config/api.config.js` | 获取方式同上,特别注意这个**需要对原密钥进行AES加密**(可在原作者编写的[使用文档](https://ovi.swo.moe/zh/docs/advanced#修改-apiconfigjs)中进行) |

### 可选变量
| 名称 | 描述 | 原路径 | 说明 |
| --- | --- | --- | --- |
| `NEXT_PUBLIC_PROTECTED_ROUTES` | 需要密码访问的文件夹路径 | `config/site.config.js` | 格式:`/route1,/route2`, 多个路径使用`,`间隔 |
| `NEXT_PUBLIC_EMAIL` | 显示在右上角的联系Email | `config/site.config.js` | `[email protected]` |
| `KV_PREFIX` | 用于KV存储(键值对存储)的前缀 | `config/site.config.js` | Upstash只提供一个免费的`Redis`数据库,如果想要部署多个OneDrive-Index,就可为不同的Index设置不同的`KV_PREFIX`值,那么就不会有键值冲突了 |

## 说明文档

**更多玩法请查阅原作者编写的[使用文档](https://ovi.swo.moe/zh/docs/getting-started)**

## 安全风险

- 在原作者的存档版本中,部署者的OneDrive账户`userPrincipalName`、`clientId`和`obfuscatedClientSecret`都会暴露在网页的源代码中。

> 本版本在执行OAuth认证过程时会检查是否已经通过了认证,若已通过认证则会重定向到主页,否则才会继续进行OAuth认证过程。如此访问者便不能通过访问OAuth认证的链接地址轻易获取你的`clientId`
和`clientSecret`了。

- 因为Next.js的设计决策,以`NEXT_PUBLIC_`开头的环境变量不仅在服务器端可用,而且在客户端(浏览器)也可用。这意味着任何`NEXT_PUBLIC_`前缀的环境变量都会被包含在构建的JavaScript文件中,并会被发送到用户的浏览器。因此,任何访问你的网站的人都可以通过查看网站的源代码或网络请求来查看这些环境变量的值。

> 本版本把`userPrincipalName`、`clientId`、`obfuscatedClientSecret`以及`baseDirectory`变量使用了非`NEXT_PUBLIC_`前缀的环境变量,尽可能让网站浏览者不能轻易获取你的OneDrive帐号、ClientID以及ClientSecret等信息。

## 待办事项

- 将密码放在环境变量中,而不是加密目录下的`.password`文件中。

> 不过如此便比较难为不同的加密目录设置不同的访问密码了。

- 重新设计LOGO。原始LOGO的对比度太低,与页面上其他图标和字体的风格不够一致。

## License

[MIT License](LICENSE)

© 2021-2023 [spencer woo](https://spencerwoo.com)

© 2023 [iRedScarf](https://github.com/iRedScarf)

<div align="center">
Made by <a href="https://spencerwoo.com">spencer woo</a> | Modified by <a href="https://github.com/iRedScarf">iRedScarf
</div>
8 changes: 4 additions & 4 deletions config/api.config.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
* - If you are using a E5 Subscription OneDrive for Business account, the direct links of your files are not the same here.
* In which case you would need to change directLinkRegex.
*/

module.exports = {
// The clientId and clientSecret are used to authenticate the user with Microsoft Graph API using OAuth. You would
// not need to change anything here if you can authenticate with your personal Microsoft account with OneDrive International.
clientId: 'd87bcc39-1750-4ca0-ad54-f8d0efbb2735',
obfuscatedClientSecret: 'U2FsdGVkX1830zo3/pFDqaBCVBb37iLw3WnBDWGF9GIB2f4apzv0roemp8Y+iIxI3Ih5ecyukqELQEGzZlYiWg==',
// The clientId and clientSecret are used to authenticate the user with Microsoft Graph API using OAuth.
// If you are an E5 developer subscriber, set them in Vercel's environment variables `CLIENT_ID` and `CLIENT_SECRET`
// You would not need to change anything here if you can authenticate with your personal Microsoft account with OneDrive International.

// The redirectUri is the URL that the user will be redirected to after they have authenticated with Microsoft Graph API.
// Likewise, you would not need to change redirectUri if you are using your personal Microsoft account with OneDrive International.
Expand Down
64 changes: 29 additions & 35 deletions config/site.config.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,44 @@
* the title, used Google fonts, site icons, contact info, etc.
*/
module.exports = {
// This is what we use to identify who you are when you are initialising the website for the first time.
// Make sure this is exactly the same as the email address you use to sign into your Microsoft account.
// You can also put this in your Vercel's environment variable 'NEXT_PUBLIC_USER_PRINCIPLE_NAME' if you worry about
// your email being exposed in public.
userPrincipalName: process.env.NEXT_PUBLIC_USER_PRINCIPLE_NAME || '[email protected]',

// [OPTIONAL] This is the website icon to the left of the title inside the navigation bar. It should be placed under the
// /public directory of your GitHub project (not your OneDrive folder!), and referenced here by its relative path to /public.
// [OPTIONAL] This is the website icon to the left of the title inside the navigation bar.
// It should be placed under the /public directory of your GitHub project (not your OneDrive folder!), and referenced here by its relative path to /public.
icon: '/icons/128.png',

// Prefix for KV Storage
// Prefix for KV Storage.
// You can put this in Vercel's environment variable 'KV_PREFIX' without any modification here.
kvPrefix: process.env.KV_PREFIX || '',

// The name of your website. Present alongside your icon.
title: "Spencer's OneDrive",
// You can put this in Vercel's environment variable 'NEXT_PUBLIC_SITE_TITLE' without any modification here.
title: process.env.NEXT_PUBLIC_SITE_TITLE || 'OneDrive-Vercel-Index',

// [OPTIONAL] This is where you specify the folders that are password protected.
// It is an array of paths pointing to all the directories in which you have .password set. Check the documentation for details.
// You can put this in Vercel's environment variable 'NEXT_PUBLIC_PROTECTED_ROUTES' without any modification here.
protectedRoutes: process.env.NEXT_PUBLIC_PROTECTED_ROUTES ? process.env.NEXT_PUBLIC_PROTECTED_ROUTES.split(',') : [],

// [OPTIONAL] If you want to display the email used to contact you on the right side of the nav bar,
// you can set it in Vercel's environment variable 'NEXT_PUBLIC_EMAIL' without any modification here.
email: process.env.NEXT_PUBLIC_EMAIL ? `mailto:${process.env.NEXT_PUBLIC_EMAIL}` : '',

// [OPTIONAL] The footer component of your website. You can write HTML here, but you need to escape double quotes - changing " to \".
// You can write anything here, and if you like badges, generate some with https://shields.io
footer:
'Powered by <a href="https://github.com/iRedScarf/onedrive-vercel-index" target="_blank" rel="noopener noreferrer">onedrive-vercel-index</a>.',

// The folder that you are to share publicly with onedrive-vercel-index. Use '/' if you want to share your root folder.
baseDirectory: '/Public',
// [OPTIONAL] This is an array of names and links for setting your social information and links.
// In the latest update, all brand icons inside font awesome is supported and the icon to render is based on the name you provide. See the documentation for details.
links: [
{
name: 'GitHub',
link: 'https://github.com/iRedScarf/onedrive-vercel-index',
},
],

// [OPTIONAL] This represents the maximum number of items that one directory lists, pagination supported.
// Do note that this is limited up to 200 items by the upstream OneDrive API.
maxItems: 100,
maxItems: 200,

// [OPTIONAL] We use Google Fonts natively for font customisations.
// You can check and generate the required links and names at https://fonts.google.com.
Expand All @@ -35,28 +51,6 @@ module.exports = {
// googleFontLinks - an array of links for referencing the google font assets.
googleFontLinks: ['https://fonts.googleapis.com/css2?family=Fira+Mono&family=Inter:wght@400;500;700&display=swap'],

// [OPTIONAL] The footer component of your website. You can write HTML here, but you need to escape double
// quotes - changing " to \". You can write anything here, and if you like badges, generate some with https://shields.io
footer:
'Powered by <a href="https://github.com/spencerwooo/onedrive-vercel-index" target="_blank" rel="noopener noreferrer">onedrive-vercel-index</a>. Made with ❤ by SpencerWoo.',

// [OPTIONAL] This is where you specify the folders that are password protected. It is an array of paths pointing to all
// the directories in which you have .password set. Check the documentation for details.
protectedRoutes: ['/🌞 Private folder/u-need-a-password', '/🥟 Some test files/Protected route'],

// [OPTIONAL] Use "" here if you want to remove this email address from the nav bar.
email: 'mailto:[email protected]',

// [OPTIONAL] This is an array of names and links for setting your social information and links.
// In the latest update, all brand icons inside font awesome is supported and the icon to render is based on the name
// you provide. See the documentation for details.
links: [
{
name: 'GitHub',
link: 'https://github.com/spencerwooo/onedrive-vercel-index',
},
],

// This is a day.js-style datetime format string to format datetimes in the app. Ref to
// https://day.js.org/docs/en/display/format for detailed specification. The default value is ISO 8601 full datetime
// without timezone and replacing T with space.
Expand Down
Empty file modified i18next-parser.config.js
100644 → 100755
Empty file.
Empty file modified i18next.d.ts
100644 → 100755
Empty file.
Empty file modified next-env.d.ts
100644 → 100755
Empty file.
Empty file modified next-i18next.config.js
100644 → 100755
Empty file.
Empty file modified next.config.js
100644 → 100755
Empty file.
Empty file modified package.json
100644 → 100755
Empty file.
Empty file modified pnpm-lock.yaml
100644 → 100755
Empty file.
Empty file modified postcss.config.js
100644 → 100755
Empty file.
Empty file modified public/demo.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/footer.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/header.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/icons/128.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/icons/256.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/icons/512.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/icons/64.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-celebration.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-come-back-later.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-fireworks.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-page-not-found.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-rip-2.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/fabulous-wapmire-weekdays.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/images/step-2-screenshot.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/locales/de-DE/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/en/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/es/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/hi/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/id/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/tr-TR/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/zh-CN/common.json
100644 → 100755
Empty file.
Empty file modified public/locales/zh-TW/common.json
100644 → 100755
Empty file.
Empty file modified public/players/iina.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/players/nplayer.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/players/potplayer.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified public/players/vlc.png
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified renovate.json
100644 → 100755
Empty file.
Empty file modified src/components/Auth.tsx
100644 → 100755
Empty file.
Empty file modified src/components/Breadcrumb.tsx
100644 → 100755
Empty file.
Empty file modified src/components/CustomEmbedLinkMenu.tsx
100644 → 100755
Empty file.
Empty file modified src/components/DownloadBtnGtoup.tsx
100644 → 100755
Empty file.
Empty file modified src/components/FileListing.tsx
100644 → 100755
Empty file.
Empty file modified src/components/FolderGridLayout.tsx
100644 → 100755
Empty file.
Empty file modified src/components/FolderListLayout.tsx
100644 → 100755
Empty file.
Empty file modified src/components/Footer.tsx
100644 → 100755
Empty file.
Empty file modified src/components/FourOhFour.tsx
100644 → 100755
Empty file.
Empty file modified src/components/Loading.tsx
100644 → 100755
Empty file.
Empty file modified src/components/MultiFileDownloader.tsx
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions src/components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,20 @@ const Navbar = () => {
className="flex items-center space-x-2 hover:opacity-80 dark:text-white"
>
<FontAwesomeIcon icon={['fab', l.name.toLowerCase() as IconName]} />
<span className="hidden text-sm font-medium md:inline-block">
{/*<span className="hidden text-sm font-medium md:inline-block">
{
// Append link name comments here to add translations
// t('Weibo')
t(l.name)
}
</span>
</span>*/}
</a>
))}

{siteConfig.email && (
<a href={siteConfig.email} className="flex items-center space-x-2 hover:opacity-80 dark:text-white">
<FontAwesomeIcon icon={['far', 'envelope']} />
<span className="hidden text-sm font-medium md:inline-block">{t('Email')}</span>
{/*<span className="hidden text-sm font-medium md:inline-block">{t('Email')}</span>*/}
</a>
)}

Expand Down
Empty file modified src/components/SearchModal.tsx
100644 → 100755
Empty file.
Empty file modified src/components/SwitchLang.tsx
100644 → 100755
Empty file.
Empty file modified src/components/SwitchLayout.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/AudioPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/CodePreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/Containers.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/DefaultPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/EPUBPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/ImagePreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/MarkdownPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/OfficePreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/PDFPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/TextPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/URLPreview.tsx
100644 → 100755
Empty file.
Empty file modified src/components/previews/VideoPreview.tsx
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion src/pages/[...path].tsx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ import SwitchLayout from '../components/SwitchLayout'

export default function Folders() {
const { query } = useRouter()
const title = (query.path && Array.isArray(query.path) ? query.path[query.path.length - 1] : '')

return (
<div className="flex min-h-screen flex-col items-center justify-center bg-white dark:bg-gray-900">
<Head>
<title>{siteConfig.title}</title>
<title>{title}</title>
</Head>

<main className="flex w-full flex-1 flex-col bg-gray-50 dark:bg-gray-800">
Expand Down
Empty file modified src/pages/_app.tsx
100644 → 100755
Empty file.
Empty file modified src/pages/_document.tsx
100644 → 100755
Empty file.
10 changes: 10 additions & 0 deletions src/pages/api/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { NextApiRequest, NextApiResponse } from 'next'

export default function handler(req: NextApiRequest, res: NextApiResponse) {
res.status(200).json({
clientId: process.env.CLIENT_ID || '',
clientSecret: process.env.CLIENT_SECRET || '',
userPrincipalName: process.env.USER_PRINCIPAL_NAME || '',
baseDirectory: process.env.BASE_DIRECTORY || '/'
})
}
7 changes: 4 additions & 3 deletions src/pages/api/index.ts
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ import { compareHashedToken } from '../../utils/protectedRouteHandler'
import { getOdAuthTokens, storeOdAuthTokens } from '../../utils/odAuthTokenStore'
import { runCorsMiddleware } from './raw'

const basePath = pathPosix.resolve('/', siteConfig.baseDirectory)
const clientSecret = revealObfuscatedToken(apiConfig.obfuscatedClientSecret)
const basePath = pathPosix.resolve('/', process.env.BASE_DIRECTORY || '/')
const clientId = process.env.CLIENT_ID || ''
const clientSecret = revealObfuscatedToken(process.env.CLIENT_SECRET || '')

/**
* Encode the path of the file relative to the base directory
Expand Down Expand Up @@ -50,7 +51,7 @@ export async function getAccessToken(): Promise<string> {

// Fetch new access token with in storage refresh token
const body = new URLSearchParams()
body.append('client_id', apiConfig.clientId)
body.append('client_id', clientId)
body.append('redirect_uri', apiConfig.redirectUri)
body.append('client_secret', clientSecret)
body.append('refresh_token', refreshToken)
Expand Down
Empty file modified src/pages/api/item.ts
100644 → 100755
Empty file.
Empty file modified src/pages/api/name/[name].ts
100644 → 100755
Empty file.
Empty file modified src/pages/api/raw.ts
100644 → 100755
Empty file.
Empty file modified src/pages/api/search.ts
100644 → 100755
Empty file.
Empty file modified src/pages/api/thumbnail.ts
100644 → 100755
Empty file.
Empty file modified src/pages/index.tsx
100644 → 100755
Empty file.
Loading