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

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
DogTorrent committed Jul 15, 2022
2 parents 3a5c807 + d6aa1d6 commit 3abd52c
Show file tree
Hide file tree
Showing 11 changed files with 379 additions and 8 deletions.
2 changes: 1 addition & 1 deletion components/FileListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
.filter(c => selected[c.id])
.map(c => ({
name: c.name,
url: `/api/raw/?path=${path}/${c.name}${hashedToken ? `&odpt=${hashedToken}` : ''}`,
url: `/api/raw/?path=${path}/${encodeURIComponent(c.name)}${hashedToken ? `&odpt=${hashedToken}` : ''}`,
}))

if (files.length == 1) {
Expand Down
14 changes: 12 additions & 2 deletions components/SearchModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,22 @@ function SearchResultItemTemplate({
}

function SearchResultItemLoadRemote({ result }: { result: OdSearchResult[number] }) {
const { data, error }: SWRResponse<OdDriveItem, string> = useSWR(`/api/item/?id=${result.id}`, fetcher)
const { data, error }: SWRResponse<OdDriveItem, { status: number; message: any }> = useSWR(
`/api/item/?id=${result.id}`,
fetcher
)

const { t } = useTranslation()

if (error) {
return <SearchResultItemTemplate driveItem={result} driveItemPath={''} itemDescription={error} disabled={true} />
return (
<SearchResultItemTemplate
driveItem={result}
driveItemPath={''}
itemDescription={typeof error.message?.error === 'string' ? error.message.error : JSON.stringify(error.message)}
disabled={true}
/>
)
}
if (!data) {
return (
Expand Down
6 changes: 6 additions & 0 deletions components/SwitchLang.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ const localeText = (locale: string): string => {
return '🇬🇧 English'
case 'zh-CN':
return '🇨🇳 简体中文'
case 'hi':
return '🇮🇳 हिन्दी'
case 'tr-TR':
return '🇹🇷 Türkçe'
case 'zh-TW':
return '🇹🇼 繁體中文'
default:
return '🇬🇧 English'
}
Expand Down
5 changes: 4 additions & 1 deletion components/previews/AudioPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const AudioPreview: FC<{ file: OdFileObject }> = ({ file }) => {

const rapRef = useRef<ReactAudioPlayer>(null)
const [playerStatus, setPlayerStatus] = useState(PlayerState.Loading)
const [playerVolume, setPlayerVolume] = useState(1)

// Render audio thumbnail, and also check for broken thumbnails
const thumbnail = `/api/thumbnail/?path=${asPath}&size=medium${hashedToken ? `&odpt=${hashedToken}` : ''}`
Expand All @@ -35,7 +36,7 @@ const AudioPreview: FC<{ file: OdFileObject }> = ({ file }) => {
// Manually get the HTML audio element and set onplaying event.
// - As the default event callbacks provided by the React component does not guarantee playing state to be set
// - properly when the user seeks through the timeline or the audio is buffered.
const rap = (rapRef.current as ReactAudioPlayer).audioEl.current
const rap = rapRef.current?.audioEl.current
if (rap) {
rap.oncanplay = () => setPlayerStatus(PlayerState.Ready)
rap.onended = () => setPlayerStatus(PlayerState.Paused)
Expand All @@ -45,6 +46,7 @@ const AudioPreview: FC<{ file: OdFileObject }> = ({ file }) => {
rap.onseeking = () => setPlayerStatus(PlayerState.Loading)
rap.onwaiting = () => setPlayerStatus(PlayerState.Loading)
rap.onerror = () => setPlayerStatus(PlayerState.Paused)
rap.onvolumechange = () => setPlayerVolume(rap.volume)
}
}, [])

Expand Down Expand Up @@ -98,6 +100,7 @@ const AudioPreview: FC<{ file: OdFileObject }> = ({ file }) => {
ref={rapRef}
controls
preload="auto"
volume={playerVolume}
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/previews/EPUBPreview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const EPUBPreview: FC<{ file: OdFileObject }> = ({ file }) => {
}}
>
<ReactReader
url={`/api/raw/?path=${asPath}${hashedToken ? '&token=' + hashedToken : ''}`}
url={`/api/raw/?path=${asPath}${hashedToken ? '&odpt=' + hashedToken : ''}`}
getRendition={rendition => fixEpub(rendition)}
loadingView={<Loading loadingText={t('Loading EPUB ...')} />}
location={location}
Expand Down
2 changes: 1 addition & 1 deletion next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path')
module.exports = {
i18n: {
defaultLocale: 'en',
locales: ['en', 'zh-CN']
locales: ['en', 'zh-CN', 'hi', 'tr-TR', 'zh-TW']
},
localePath: path.resolve('public/locales'),
reloadOnPrerender: process.env.NODE_ENV === 'development',
Expand Down
2 changes: 1 addition & 1 deletion pages/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export async function checkAuthRoute(
if (
!compareHashedToken({
odTokenHeader: odTokenHeader,
dotPassword: odProtectedToken.data,
dotPassword: odProtectedToken.data.toString(),
})
) {
return { code: 401, message: 'Password required.' }
Expand Down
116 changes: 116 additions & 0 deletions public/locales/hi/common.json

Large diffs are not rendered by default.

120 changes: 120 additions & 0 deletions public/locales/tr-TR/common.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
{
"- showing {{count}} page(s) ——one": "- {{count}} sayfa gösteriliyor ",
"- showing {{count}} page(s) ——other": "- {{count}} sayfalar gösteriliyor ",
"{{count}} item(s)——one": "{{count}} öğe",
"{{count}} item(s)——other": "{{count}} öğeler",
"<0></0> If you are not the owner of this website, stop now, as continuing with this process may expose your personal files in OneDrive.": "<0></0> Bu web sitesinin sahibi değilseniz, şimdi durun, çünkü bu işleme devam etmek OneDrive'daki kişisel dosyalarınızı açığa çıkarabilir..",
"<0></0> If you have not specified a REDIS_URL inside your Vercel env variable, go initialise one at <3>Upstash</3>. Docs: <6>Vercel Integration - Upstash</6>.": "<0></0> Vercel env değişkeninizin içinde bir REDIS_URL belirtmediyseniz, gidin ve bir tane başlatın. <3> Upstash </3>. Docs: <6>Vercel Entegrasyonu - Upstash</6>.",
"<0></0> If you see anything missing or incorrect, you need to reconfigure <3>/config/api.config.js</3> and redeploy this instance.": "<0></0> Eksik veya yanlış bir şey görürseniz, yeniden yapılandırmanız gerekir. <3>/config/api.config.js</3> ve bu örneği yeniden dağıtın.",
"✅ You can now proceed onto the next step: requesting your access token and refresh token.": "✅ Artık bir sonraki adıma geçebilirsiniz: erişim tokeninizi isteyin ve tokeni yenileyin..",
"❌ No valid code extracted.": "❌ Geçerli Kod Çıkarılmadı.",
"Acquired access_token: ": "Alınan access_token: ",
"Acquired refresh_token: ": "Alınan refresh_token: ",
"Actions": "Hareketler",
"Authorisation is required as no valid <2>access_token</2> or <5>refresh_token</5> is present on this deployed instance. Check the following configurations before proceeding with authorising onedrive-vercel-index with your own Microsoft account.": "Geçerli olmadığı için yetkilendirme gerekli <2>access_token</2> ya da <5>refresh_token</5> bu dağıtılan örnekte mevcut. Onedrive-vercel-index'i kendi Microsoft hesabınızla yetkilendirmeye devam etmeden önce aşağıdaki yapılandırmaları kontrol edin.",
"Cancel": "Iptal",
"Cannot preview {{path}}": "{{path}} önizlenemiyor",
"Change the raw file direct link to a URL ending with the extension of the file.": "Ham dosyanın doğrudan bağlantısını, dosyanın uzantısıyla biten bir URL'ye değiştirin.",
"Check out <2>Microsoft's official explanation</2> on the error message.": "Hata mesajıyla ilgili <2>Microsoft'un resmi açıklamasıni</2> inceleyin.",
"Clear all": "Hepsini Sil",
"Clear all tokens?": "Tüm Tokenleri Sil ?",
"Cleared all tokens": "Tüm Tokenler Silindi..",
"clearing them means that you will need to re-enter the passwords again.": "Tokenleri temizlemek, şifreleri tekrar girmeniz gerekeceği anlamına gelir..",
"Copied direct link to clipboard.": "Panoya Bağlantı Kopyalandı.",
"Copied folder permalink.": "Kopyalanan Klasör Bağlantısı.",
"Copied raw file permalink.": "Kopyalanan Dosya Bağlantısı.",
"Copy direct link": "Doğrudan Bağlantıyı Kopyalayın",
"Copy folder permalink": "Klasör Bağlantısını Kopyala",
"Copy raw file permalink": "Ham dosya Bağlantısını Kopyala",
"Copy the permalink to the file to the clipboard": "Dosyanın Bağlantısını Kopyalayın",
"Customise direct link": "Doğrudan Bağlantıyı Ozelleştir",
"Customise link": "Bağlantıyı Ozelleştir",
"Customised": "Özelleştirilmiş",
"Customised and encoded": "Özelleştirilmiş ve Kodlanmış",
"Default": "Varsayılan",
"Do not pretend to be the site owner": "Site sahibiymiş gibi davranmayın..",
"Don't worry, after storing them, onedrive-vercel-index will take care of token refreshes and updates after your site goes live.": "Endişelenmeyin, bunları depoladıktan sonra onedrive-vercel-index siteniz yayına girdikten sonra belirteç yenilemeleri ve güncellemeleriyle ilgilenecektir..",
"Download": "Indir",
"Download file": "Dosyayı Indir",
"Download folder": "Klasörü Indir",
"Download selected files": "Seçili Dosyaları Indir",
"Download the file directly through OneDrive": "Dosyayı doğrudan OneDrive üzerinden indirin",
"Downloading {{progress}}%": "indiriliyor {{progress}}%",
"Downloading folder, refresh page to cancel": "Klasör indiriliyor, iptal etmek için sayfayı yenileyin",
"Downloading selected files, refresh page to cancel": "Seçili dosyalar indiriliyor, iptal etmek için sayfayı yenileyin",
"Downloading selected files...": "Seçilen Dosyalar Indiriliyor...",
"Email": "Mail",
"Enter Password": "Parola Gir",
"Error storing the token": "Token Yedeklenirken Hata Oluştu",
"Error validating identify, restart": "Tanımlama Doğrulanırken Hata Oluştu, Yeniden Başlat",
"Error: {{message}}": "Hata: {{message}}",
"Failed to download folder {{path}}: {{status}} {{message}} Skipped it to continue.": "Klasör indirilemedi {{path}}: {{status}} {{message}} Devam etmek için atlandı.",
"Failed to download folder.": "Klasor Indirme tamamlanmadı.",
"Failed to download selected files.": "Seçilen Dosyalar Indirilemedi.",
"File is empty.": "Dosya Boş.",
"File size": "Dosya Boyutu",
"Filename": "Dosya Adı",
"Final step, click the button below to store these tokens persistently before they expire after {{minutes}} minutes {{seconds}} seconds. ": "Son adım, {{minutes}} dakika {{seconds}} saniye sonra sona ermeden önce bu tokenleri kalıcı olarak saklamak için aşağıdaki düğmeye tıklayın.. ",
"Finished downloading folder.": "Klasor Indirme Tamamlandı.",
"Finished downloading selected files.": "Seçilen Dosyaların Indirilmesi Tamamlandı.",
"Get tokens": "Token Al",
"Grid": "Izgara",
"Hashes": "Karmalar",
"Home": "Anasayfa",
"If you go back home and still see the welcome page telling you to re-authenticate, ": "Anasayfa'ya dönün ve yeniden kimlik doğrulamanızı söyleyen hoş geldiniz sayfasını görmeye devam edin, ",
"If you know the password, please enter it below.": "Şifreyi Biliyorsanız, lütfen Girin.",
"Last modified": "Son Düzenleme",
"Last Modified": "Son Düzenleme",
"Last modified:": "Son Düzenleme:",
"List": "Liste",
"Load more": "Daha Fazla Göster",
"Loading ...": "Yükleniyor ...",
"Loading EPUB ...": "EPUB Yükleniyor ...",
"Loading file content...": "Dosya içeriği Yükleniyor...",
"Loading FLV extension...": "FLV uzantısı Yükleniyor...",
"Logout": "Çıkış",
"MIME type": "Dosya Tipi",
"Name": "Ad",
"No more files": "Başka Dosya Yok",
"Nothing here.": "Burada Hiçbir Yok.",
"OAuth Step 1 - {{title}}": "OAuth Adım 1 - {{title}}",
"OAuth Step 2 - {{title}}": "OAuth Adım 2 - {{title}}",
"OAuth Step 3 - {{title}}": "OAuth Adım 3 - {{title}}",
"of {{count}} file(s) -——loaded——one": "{{count}} dosya -",
"of {{count}} file(s) -——loaded——other": "... {{count}} Dosyalar -",
"of {{count}} file(s) -——loading——one": "... {{count}} Dosya -",
"of {{count}} file(s) -——loading——other": "... Dosya(lar) -",
"Oops, that's a <1>four-oh-four</1>.": "Hata, bu bir <1>four-oh-four</1> Bilgileri Kontrol Et.",
"Open URL": "Link Aç",
"Open URL{{url}}": "URL'yi Aç {{url}}",
"Press <2>F12</2> and open devtools for more details, or seek help at <6>onedrive-vercel-index discussions</6>.": "Daha fazla ayrıntı için <2>F12</2> Basın Devtools'u açın veya şu adresten yardım isteyin: <6>Onedrive-vercel-index Tartışmalar</6>.",
"Proceed to OAuth": "OAuth'a Devam Edin",
"Requesting tokens": "Token Isteniyor..",
"Restart": "Yeniden Başlat",
"revisit home and do a hard refresh.": "Anasayfa'ya Tekrar Gidin ve Yenileme Yapın.",
"Search ...": "Ara ...",
"Select all files": "Tüm dosyaları seç",
"Select file": "Dosya Seç",
"Select files": "Dosyaları seçin",
"Size": "Boyut",
"Step 1/3: Preparations": "Adım 1/3: Hazırlıklar",
"Step 2/3: Get authorisation code": "Adım 2/3: Yetkilendirme kodunu alın",
"Step 3/3: Get access and refresh tokens": "Adım 3/3: Erişim elde edin ve belirteçleri yenileyin",
"Store tokens": "Tokeni Saklayın",
"Stored! Going home...": "Yedeklendi! Anasayfa'ya Gidiliyor...",
"Storing tokens": "Token Yedeklendi",
"Success! The API returned what we needed.": "Başarılı! API ihtiyacımız Olan Değeri Döndürdü.",
"The authorisation code extracted is:": "Çıkarılan Yetkilendirme Kodu:",
"The OAuth link for getting the authorisation code has been created. Click on the link above to get the <2>authorisation code</2>. Your browser willopen a new tab to Microsoft's account login page. After logging in and authenticating with your Microsoft account, you will be redirected to a blank page on localhost. Paste <6>the entire redirected URL</6> down below.": "Yetkilendirme kodunu almak için OAuth bağlantısı oluşturuldu. almak için yukarıdaki linke tıklayın <2>Yetkilendirme Kodu</2>. Tarayıcınız, Microsoft'un hesap oturum açma sayfasına yeni bir sekme açacaktır. Giriş yaptıktan ve Microsoft hesabınızla kimlik doğrulaması yaptıktan sonra, localhost'ta boş bir sayfaya yönlendirileceksiniz. <6>Yönlendirilen URL'nin tamamını yapıştırın</6>.",
"These tokens are used to authenticate yourself into password protected folders, ": "Bu tokenler, kendinizi parola korumalı klasörlerde doğrulamak için kullanılır, ",
"These tokens may take a few seconds to populate after you click the button below. ": "Aşağıdaki düğmeyi tıkladıktan sonra bu tokenlerin doldurulması birkaç saniye sürebilir. ",
"This route (the folder itself and the files inside) is password protected. ": "Klasör ve Içindeki Dosyalar Parola Ile Korumalıdır...",
"Unavailable": "Kullanım Dışı",
"URL encoded": "URL Kodlanmış",
"Waiting for code...": "Kod Bekleniyor...",
"Weibo": "Weibo",
"Welcome to your new onedrive-vercel-index 🎉": "Onedrive-vercel-index'inize hoş geldiniz 🎉",
"What is this?": "Bu Nedir?",
"Where is the auth code? Did you follow step 2 you silly donut?": "Yetkilendirme kodu nerede? 2. adımı izledin mi seni Aptal ?",
"Whoops, looks like we got a problem: {{error}}.": "Hata! Bir sorunumuz var gibi görünüyor: {{error}}."
}
Loading

0 comments on commit 3abd52c

Please sign in to comment.