Add pc local wish import option

- fix #38
pull/1/head
Made Baruna 2021-04-23 05:07:16 +08:00
parent 41fce281de
commit 5b910e8124
No known key found for this signature in database
GPG Key ID: 5AA5DA16AA5DCEAD
3 changed files with 60 additions and 23 deletions

View File

@ -341,18 +341,18 @@
}
function importFromGeneratedText() {
if (!generatedTextInput.startsWith('paimonmoeimporterv1###')) {
if (!generatedTextInput.startsWith('paimonmoe,importer,version,1,0')) {
pushToast('Invalid data, please use the latest importer app', 'error');
return;
}
processingLog = true;
const rows = generatedTextInput.substring(22).split(';');
const rows = generatedTextInput.substring(30).split('\n');
const weapons = Object.values(weaponList);
const chars = Object.values(characters);
try {
for (let row of rows) {
if (row === '') continue;
@ -362,6 +362,11 @@
const time = dayjs(cell[1]);
const name = cell[2];
const type = cell[3].replace(/ /g, '');
const newestPullTime = getNewestPullTime(types[code]);
if (time.unix() <= newestPullTime) {
continue;
}
let id;
if (type === 'Weapon') {
@ -630,8 +635,7 @@
>{$t('wish.import.faqs.a5.1')}</a
>
{$t('wish.import.faqs.a5.2')}
<!-- If you don't want any passing around your url, you can use the small importer app to process the wish
history on your local PC (PC Local option) -->
{$t('wish.import.faqs.a5.3')}
</p>
<p class="text-white font-semibold mt-4">{$t('wish.import.faqs.q6')}</p>
<p class="text-gray-400">{$t('wish.import.faqs.a6')}</p>
@ -650,12 +654,6 @@
<button on:click={() => changeSelectedType('pc')} class={`pill ${selectedType === 'pc' ? 'active' : ''}`}>
PC
</button>
<!-- <button
on:click={() => changeSelectedType('pclocal')}
class={`pill ${selectedType === 'pclocal' ? 'active' : ''}`}
>
PC Local
</button> -->
<button
on:click={() => changeSelectedType('android')}
class={`pill ${selectedType === 'android' ? 'active' : ''}`}
@ -668,6 +666,12 @@
<button on:click={() => changeSelectedType('ps')} class={`pill ${selectedType === 'ps' ? 'active' : ''}`}>
PS
</button>
<button
on:click={() => changeSelectedType('pclocal')}
class={`pill ${selectedType === 'pclocal' ? 'active' : ''}`}
>
PC Local
</button>
</div>
{#if selectedType === 'pc'}
<div class="bg-background rounded-xl px-4 py-2 text-white mb-4 mt-2">
@ -681,19 +685,24 @@
<Input bind:value={genshinLink} placeholder={$t('wish.import.guide.pc.4')} />
{:else if selectedType === 'pclocal'}
<div class="bg-background rounded-xl px-4 py-2 text-white mb-4 mt-2">
{$t('wish.import.guide.pclocal.0')}
<span class="text-red-300">{$t('wish.import.guide.pclocal.10')}</span>
<ol class="list-decimal ml-4">
<li class="mt-2 mb-0">
Downlod the importer app <Button size="sm" on:click={() => toggleFaqs(true)}>
<Icon path={mdiDownload} color="white" />
Download
</Button>
</li>
<li class="my-2">Open the wish history on your Genshin impact in this PC</li>
<li class="my-2">Press IMPORT</li>
<li class="my-2">Copy & paste the generated text to the textbox below</li>
<li class="my-2">{$t('wish.import.guide.pclocal.1')}</li>
<li class="my-2">{$t('wish.import.guide.pclocal.2')}</li>
<pre
class="bg-black bg-opacity-50 whitespace-pre-wrap break-all p-2 rounded-xl text-xs">{$t('wish.import.guide.pclocal.3')}</pre>
<p>
{$t('wish.import.guide.pclocal.4')}
<a class="text-blue-400 hover:underline" href={$t('wish.import.guide.pclocal.6')} target="_blank">
{$t('wish.import.guide.pclocal.5')}
</a>
</p>
<li class="my-2">{$t('wish.import.guide.pclocal.7')}</li>
<li class="my-2">{$t('wish.import.guide.pclocal.8')}</li>
</ol>
</div>
<Textarea bind:value={generatedTextInput} placeholder="Paste the generated text here..." />
<Textarea bind:value={generatedTextInput} placeholder={$t('wish.import.guide.pclocal.9')} />
{:else if selectedType === 'android'}
<div class="bg-background rounded-xl px-4 py-2 text-white mb-4 mt-2">
<a href="https://www.youtube.com/watch?v=dphwcYfZthA" target="_blank" class="text-primary hover:underline">

View File

@ -168,7 +168,8 @@
"a5": [
"Paimon.moe will never store your keys, and uses HTTPS to pass your URL to a CORS proxy to make the CORS work. Paimon.moe will save your 4* pity, 5* pity, and 5* wish information if you submit your wish for our global wish tally (no private information saved! please check",
"Privacy Policy",
"for more information). You can uncheck submit wish tally to disable wish submission. Then all your wish history is saved on your device (or your Google Drive if you turned on sync)."
"for more information). You can uncheck submit wish tally to disable wish submission. Then all your wish history is saved on your device (or your Google Drive if you turned on sync).",
"If you don't want any passing around your url, you can use the small importer script to process the wish history on your local PC (PC Local option) "
],
"q6": "I've done all the steps, but I got some API error?",
"a6": "Make sure you copy all the text (hold and press Select All for mobile devices); maybe you missed some text that are needed for the importer to work.",
@ -213,6 +214,19 @@
"Scan the QR Code with your phone",
"Copy the link, and paste it below",
"Paste link here..."
],
"pclocal": [
"If you are not comfortable passing around your feedback url, you can use this option to process the wish on your pc locally. This script will read the log file on your pc to get the wish history url.",
"Open Start, then search for Powershell",
"Open Windows Powershell, then copy & paste the script below to the Powershell",
"iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/MadeBaruna/9ff8b7a2af11f3002395af7963b5ed18/raw/cdfead30f830b897e8822a40f98fea5340dbd62e/importer.ps1'))",
"You can review the script",
"here",
"https://gist.github.com/MadeBaruna/9ff8b7a2af11f3002395af7963b5ed18",
"Press enter to run the script, then follow the instruction there",
"After that, paste the result of the script to the input below",
"Paste the result here...",
"This feature is still in beta, please make a backup first by going to Help & Settings menu then Export to Excel."
]
}
},

View File

@ -143,7 +143,8 @@
"a5": [
"Paimon.moe tidak menyimpan key mu, dan menggunakan HTTPS untuk mengirim link mu ke proxy cors sehingga bisa digunakan. Paimon.moe akan menyimpan pity 4*, pity 5*, dan informasi wish 5* jika kamu mensubmit wish mu ke perhitungan pity global paimon.moe (tidak ada data pribadi yang disimpan! harap cek",
"Privacy Policy",
"untuk info lebih lanjut). Kamu bisa tidak mencentang submit pity untuk tidak mengirim data wish. Kemudian semua data riwayat wish mu disimpan pada device masing-masing (atau google drive mu jika kamu menyalakan sync di setting)."
"untuk info lebih lanjut). Kamu bisa tidak mencentang submit pity untuk tidak mengirim data wish. Kemudian semua data riwayat wish mu disimpan pada device masing-masing (atau google drive mu jika kamu menyalakan sync di setting).",
"Jika kamu tidak ingin link feedback mu kemana-mana, kamu bisa menggunakan script importer yang akan memproses riwayat history secara lokal di pc mu (opsi PC Local) "
],
"q6": "Saya udah coba step-step nya, tapi kok malah dapet API error?",
"a6": "Coba pastiin sudah di copy semua text nya (coba select all aja text nya, jangan di potong-potong), mungkin ada yang kelewatan, jadi ada yang terpotong",
@ -188,6 +189,19 @@
"Scan QR Code nya dengan HP mu",
"Copy link nya dan paste ke input di bawah",
"Paste link disini..."
],
"pclocal": [
"Jika kamu tidak nyaman dengan menaruh link feedback disini, kamu bisa memproses riwayat wish di pc mu secara lokal. Script ini akan membaca file log di pc mu untuk memproses riwayat history mu.",
"Buka Start, kemudian cari Powershell",
"Buka Windows Powershell, kemudian copy & paste script berikut di Powershell nya",
"iex ((New-Object System.Net.WebClient).DownloadString('https://gist.githubusercontent.com/MadeBaruna/9ff8b7a2af11f3002395af7963b5ed18/raw/cdfead30f830b897e8822a40f98fea5340dbd62e/importer.ps1'))",
"Kamu bisa me-review script nya",
"disini",
"https://gist.github.com/MadeBaruna/9ff8b7a2af11f3002395af7963b5ed18",
"Tekan enter untuk menjalankan scriptnya, kemudian ikuti petunjuknya disana",
"Setelah itu paste hasil dari script nya ke input di bawah",
"Paste hasil nya disini...",
"Fitur ini masih beta, harap buat backup dulu dengan pergi ke menu Bantuan & Pengaturan kemudian Export ke Excel."
]
}
},