-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from piuswalter/development
Development
- Loading branch information
Showing
67 changed files
with
613 additions
and
441 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,51 @@ | ||
# StudyOffline | ||
<div align="center"> | ||
<a href="#"><img src="https://raw.githubusercontent.com/piuswalter/StudyOffline/main/logo.png" alt="StudyOffline" width="200"></a> | ||
<br /> | ||
<h1>StudyOffline</h1> | ||
<small>Built with ❤️ and 🍺 by | ||
<a href="https://github.com/p-fruck">Philipp</a>, | ||
<a href="https://github.com/piuswalter">Pius</a> and | ||
<a href="https://github.com/piuswalter/StudyOffline/graphs/contributors">contributors</a> | ||
</small> | ||
</div> | ||
|
||
--- | ||
|
||
[![GitHub license](https://img.shields.io/github/license/piuswalter/StudyOffline)](https://github.com/piuswalter/StudyOffline/blob/main/LICENSE.md) | ||
![GitHub last commit (branch)](https://img.shields.io/github/last-commit/piuswalter/StudyOffline/development) | ||
[![GitHub issues](https://img.shields.io/github/issues/piuswalter/StudyOffline)](https://github.com/piuswalter/StudyOffline/issues) | ||
![Lines of code](https://img.shields.io/tokei/lines/github/piuswalter/StudyOffline) | ||
![GitHub language count](https://img.shields.io/github/languages/count/piuswalter/StudyOffline) | ||
|
||
StudyOffline is an open source tool that allows you to download the flashcards you have created on StudySmarter and study them offline. | ||
|
||
In addition, StudyOffline is a PWA (Progressive Web App) with which you can also learn your flashcards on any smartphone. | ||
|
||
## ⚒️ Setup your own StudyOffline instance | ||
|
||
[![Deploy with Docker](https://img.shields.io/badge/deploy%20with-docker-0db7ed)]() | ||
|
||
At the moment we do not have published StudyOffline to any container registry yet but you can easily build it by hand. | ||
|
||
The requirement is that Docker is installed. | ||
|
||
To do this, you just need to run | ||
|
||
`docker build https://github.com/piuswalter/StudyOffline.git#main -t studyoffline --no-cache` | ||
|
||
Now your container is built and can be started with | ||
|
||
`docker run -p 3000:3000 --name studyoffline -d studyoffline` | ||
|
||
You can access StudyOffline in your browser on `https://localhost:3000/`. | ||
|
||
## ⚙️ Built with latest technologies | ||
|
||
- [Express](https://expressjs.com/) - The web framework used at the backend | ||
- [Angular](https://angular.io/) - The web framework used at the frontend | ||
- [Node.js](https://nodejs.org/en/) - The backend power | ||
- [IndexedDB](https://developer.mozilla.org/de/docs/Web/API/IndexedDB_API) - The database to store your flashcards | ||
|
||
## 📜 License | ||
|
||
This project is licensed under the AGPL-3.0 License - see the [LICENSE.md](LICENSE.md) file for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
{ | ||
"root": true, | ||
"ignorePatterns": [ | ||
"projects/**/*" | ||
"projects/**/*", | ||
"*.spec.ts" | ||
], | ||
"overrides": [ | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { Origin } from './origin.enum'; | ||
|
||
export interface IAnswer { | ||
text: string; | ||
isCorrect: boolean; | ||
} | ||
|
||
interface FlashcardIndices { | ||
id?: number; | ||
subjectId: number; | ||
} | ||
|
||
export abstract class Flashcard { | ||
id?: number; | ||
subjectId: number; | ||
|
||
constructor(ind: FlashcardIndices) { | ||
this.id = ind.id; | ||
this.subjectId = ind.subjectId; | ||
} | ||
|
||
abstract readonly origin: Origin; | ||
abstract question: string; | ||
abstract answers: IAnswer[]; | ||
abstract hints: string[]; | ||
abstract solution: string; | ||
abstract tags: number[]; | ||
|
||
get withoutId(): Flashcard { | ||
delete this.id; | ||
return this; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { Flashcard, IAnswer } from '../flashcard.class'; | ||
import { Origin } from '../origin.enum'; | ||
|
||
export interface IInternalFlashcard { | ||
id: number; | ||
question: string; | ||
answers: IAnswer[]; | ||
hints: string[]; | ||
solution: string; | ||
tags: number[]; | ||
} | ||
|
||
export class InternalFlashcard extends Flashcard { | ||
readonly origin = Origin.internal; | ||
question: string; | ||
answers: IAnswer[]; | ||
hints: string[]; | ||
solution: string; | ||
tags: number[]; | ||
|
||
constructor(flashcard: IInternalFlashcard, subjectId: number) { | ||
super({ subjectId }); | ||
this.question = flashcard.question; | ||
this.answers = flashcard.answers; | ||
this.hints = flashcard.hints; | ||
this.solution = flashcard.solution; | ||
this.tags = flashcard.tags; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// eslint-disable-next-line no-shadow | ||
export enum Origin { | ||
internal, | ||
studySmarter | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { IStudySmarterFlashcard } from '.'; | ||
import { Flashcard, IAnswer } from '../flashcard.class'; | ||
import { Origin } from '../origin.enum'; | ||
|
||
export class StudySmarterFlashcard extends Flashcard { | ||
studySmarter: IStudySmarterFlashcard; | ||
readonly origin = Origin.studySmarter; | ||
|
||
constructor(flashcard: IStudySmarterFlashcard, subjectId: number) { | ||
super({ subjectId }); | ||
this.studySmarter = flashcard; | ||
} | ||
|
||
private get flashcardinfo() { | ||
return this.studySmarter.flashcardinfo; | ||
} | ||
|
||
get question(): string { | ||
if (!this.flashcardinfo.question_html.length) return ''; | ||
return this.flashcardinfo.question_html[0].text; | ||
} | ||
|
||
get answers(): IAnswer[] { | ||
return this.flashcardinfo.answer_html.map((answr) => ({ | ||
text: answr.text, | ||
isCorrect: answr.is_correct | ||
})); | ||
} | ||
|
||
get hints(): string[] { | ||
return this.flashcardinfo.hint_html; | ||
} | ||
|
||
get solution(): string { | ||
return this.flashcardinfo.solution_html; | ||
} | ||
|
||
get tags(): number[] { | ||
return []; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
frontend/src/app/_models/studysmarter/flashcard.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
interface StudySmarterFlashcardAnswer { | ||
text: string; | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
is_correct: boolean; | ||
} | ||
|
||
export interface IStudySmarterFlashcard { | ||
id?: number; | ||
subjects: number[]; | ||
|
||
flashcardinfo: { | ||
id?: number; | ||
creator: number; | ||
/* eslint-disable @typescript-eslint/naming-convention */ | ||
question_html: StudySmarterFlashcardAnswer[]; | ||
answer_html: StudySmarterFlashcardAnswer[]; | ||
hint_html: string[]; | ||
solution_html: string; | ||
}; | ||
community_applied_tag_ids: number[]; | ||
/* eslint-enable @typescript-eslint/naming-convention */ | ||
} |
4 changes: 3 additions & 1 deletion
4
frontend/src/app/_models/index.ts → ...end/src/app/_models/studysmarter/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
export * from './flashcard.class'; | ||
export * from './flashcard.interface'; | ||
export * from './login-request.interface'; | ||
export * from './login-response.interface'; | ||
export * from './studysmarter-response.interface'; | ||
export * from './response.interface'; | ||
export * from './subject.class'; | ||
export * from './subject.interface'; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { IStudySmarterSubject } from '.'; | ||
import { Flashcard } from '../flashcard.class'; | ||
import { Subject } from '../subject.class'; | ||
|
||
export class StudySmarterSubject extends Subject { | ||
studySmarter: IStudySmarterSubject; | ||
|
||
constructor(subject: IStudySmarterSubject, id?: number) { | ||
super(id); | ||
this.studySmarter = subject; | ||
} | ||
|
||
get name(): string { | ||
return this.studySmarter.name; | ||
} | ||
|
||
get archived(): boolean { | ||
return this.studySmarter.archived; | ||
} | ||
|
||
get flashcards(): Flashcard[] { | ||
return []; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...tend/src/app/_models/subject.interface.ts → ..._models/studysmarter/subject.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Flashcard } from './flashcard.class'; | ||
|
||
export abstract class Subject { | ||
id?: number; | ||
|
||
constructor(id?: number) { | ||
this.id = id; | ||
} | ||
|
||
abstract name: string; | ||
abstract archived: boolean; | ||
abstract flashcards: Flashcard[]; | ||
} |
Oops, something went wrong.