Skip to content

Commit

Permalink
"Refactor: Transitioned app to Tauri framework ( Rust + Javascript).
Browse files Browse the repository at this point in the history
  • Loading branch information
abdumu committed Oct 22, 2024
1 parent ff64cff commit d830e23
Show file tree
Hide file tree
Showing 169 changed files with 30,183 additions and 7,204 deletions.
72 changes: 15 additions & 57 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,168 +1,126 @@
# Logs

logs
_.log
npm-debug.log_
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log\*
lerna-debug.log*
pnpm-debug.log*

books/

app
app.exe

# Diagnostic reports (https://nodejs.org/api/report.html)

report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Runtime data

pids
_.pid
_.seed
\*.pid.lock
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover

lib-cov

.idea
.vscode
# Coverage directory used by tools like istanbul

coverage
\*.lcov
*.lcov

# nyc test coverage

.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)

.grunt

# Bower dependency directory (https://bower.io/)

bower_components

# node-waf configuration

.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)

build/Release

# Dependency directories

node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)

web_modules/

# TypeScript cache

\*.tsbuildinfo
*.tsbuildinfo

# Optional npm cache directory

.npm

# Optional eslint cache

.eslintcache

# Microbundle cache

.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history

.node_repl_history

# Output of 'npm pack'

\*.tgz
*.tgz

# Yarn Integrity file

.yarn-integrity

# dotenv environment variables file

.env
.env.test

# parcel-bundler cache (https://parceljs.org/)

.cache
.parcel-cache

# Next.js build output

.next
out

# Nuxt.js build / generate output

.nuxt
dist

# Gatsby files

.cache/

# Comment in the public line in if your project uses Gatsby and not Next.js

# https://nextjs.org/blog/next-9-1#public-directory-support

# public

# vuepress build output

.vuepress/dist

# Serverless directories

.serverless/

# FuseBox cache

.fusebox/

# DynamoDB Local files

.dynamodb/

# TernJS port file

.tern-port

# Stores VSCode versions used for testing VSCode extensions

.vscode-test

# yarn v2

.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.\*

deploy/\*\*

# forge
.pnp.*

out/
jarir_dump/
flows_jarir
test
jarir_dump.zip
jarir.har
code.c
e
deploy/**
.zed/tasks.json
27 changes: 23 additions & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
Do Use it for Personal, Educational, and Research purpose Only.
Do not Distribute or Sell.
Do not use it in anyway that jeopardize Jarir Company!
Personal Use License

You can edit/change the code unless it contradicts the previous statements.
Copyright (c) 2024 Abdulraman Mohammed

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software for personal use only, including the rights to use, copy, and modify the Software, subject to the following conditions:

1. The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
2. The Software is for personal use only. Commercial use, distribution, and modification for commercial purposes are not permitted without explicit permission from the author.
3. Modifications to the Software are only allowed when sending as a Pull Request (PR) to this repository.
4. Use it for Personal, Educational, and Research purposes only.
5. Do not distribute, sell, or make another repository/softwoare/content based on this code, the generated content or any part of it.
6. Do not use it in any way that jeopardizes Jarir/Rufoof Company or Rufuf Company.
7. Do not use it in any way that violates the privacy of any individual or organization.
8. Do not use it or the content that it generates for any illegal activities or copyright violations.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Unofficial Jarir-Reader قارئ جرير للكمبيوتر - غير رسمي
## Unofficial Jarir/Rufoof Reader قارئ جرير / رفوف للكمبيوتر - غير رسمي

View/download your purchased books from Jarir Reader and convert them to DRM-free books

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# todo: make it work for tauri
name: Build
on: [push, pull_request]

Expand Down
File renamed without changes.
File renamed without changes.
32 changes: 17 additions & 15 deletions cli/backend/api-calls.js → old_code/cli/backend/api-calls.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,22 +229,24 @@ const getUserBooks = () => {
var bookPath, book;

response.data.result.forEach((item, index) => {
// function Book(id, name, url, index, publisher, authors, cover, type, thumb, access, file_md5, file_id, latest_file_id, size, header, key, bookPath) {

book = Book(
item["book_id"],
item["title"],
item["book_file_url"],
index,
"جرير للنشر",
item["authors_name"] || ["غير معروف"],
item["cover_thumb_url"] || null,
item["file_type"],
item["cover_thumb_url"],
item["book_access"],
item["book_file_md5"],
item["bookfile_id"],
item["latest_file_id"],
item["size"],
false
item["book_id"], //id
item["title"], //name
item["book_file_url"],//url
index, //index
"جرير للنشر", //publisher
item["authors_name"] || ["غير معروف"], //authors
item["cover_thumb_url"] || null, //cover
item["file_type"],//type
item["cover_thumb_url"],//thumb
item["book_access"],//access
item["book_file_md5"],//file_md5
item["bookfile_id"],//bookfile_id
item["latest_file_id"],//latest_file_id
item["size"],//size
false//header
);
bookPath = pathResolve(
getAppDataPath("jarir-cli"),
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions cli/backend/decrypt.js → old_code/cli/backend/decrypt.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,17 @@ const decryptText = async (file, xkey) => {

//for new version
const appendFiles = async (bookFile, headerHash, userAccessToken, filePath) => {
//write log to books folder
const logFile = pathResolve(getAppDataPath("jarir-cli"), "books", "log.txt");
writeFileSync(logFile, `headerHash: ${headerHash}\nuserAccessToken: ${userAccessToken}\n`);

const sha1HashValue = crypto.createHash('sha1').update(userAccessToken + "platform").digest('hex');
writeFileSync(logFile, `SHA1 hash: ${sha1HashValue}\n`, { flag: 'a' });
const key = sha1HashValue.padEnd(32, '0').slice(0, 32);
writeFileSync(logFile, `Key: ${key}\n`, { flag: 'a' });
const iv = '1234567812345678'; // IV should be 16 bytes long
const decodedBytes = Buffer.from(headerHash, 'base64');
writeFileSync(logFile, `Decoded bytes: ${decodedBytes.toString('hex')}\n`, { flag: 'a' });
const decipher = crypto.createDecipheriv('aes-256-cbc', key, iv);
const headerBytes = Buffer.concat([decipher.update(decodedBytes), decipher.final()]);
const bodyBytes = readFileSync(bookFile);
Expand All @@ -195,7 +202,11 @@ const appendFiles = async (bookFile, headerHash, userAccessToken, filePath) => {
for (const entry of Object.values(entries)) {
if (entry.name === 'header') {
const headerBuffer = await zip.entryData(entry);
writeFileSync(logFile, `Header buffer: ${headerBuffer}\n`, { flag: 'a' });
headerKey = Array.from(headerBuffer);
writeFileSync(logFile, `Header key: ${headerKey}\n`, { flag: 'a' });
console.log("Header key: " + headerKey);

} else if (entry.name === 'body') {
const outputStream = createWriteStream(filePath);
const stream = await zip.stream(entry.name);
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions cli/backend/helpers.js → old_code/cli/backend/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ const clearResidue = (book) => {
if (existsSync(path + ".zip")) {
unlinkSync(path + ".zip");
}
if (existsSync(path + ".zip.body")) {
unlinkSync(path + ".zip.body");
}
// if (existsSync(path + ".zip.body")) {
// unlinkSync(path + ".zip.body");
// }
if (existsSync(path)) {
rmdirSync(path, {
recursive: true,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit d830e23

Please sign in to comment.