Skip to content

Commit

Permalink
Merge pull request #447 from petio-team/preview
Browse files Browse the repository at this point in the history
0.5.1 update
  • Loading branch information
AshDyson authored Jun 3, 2021
2 parents fcb42fd + d4788bd commit 0aeef82
Show file tree
Hide file tree
Showing 82 changed files with 2,211 additions and 63,827 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ admin/.eslintcache
/logs
api/.DS_Store
api/imdb_dump.txt
package-lock.json
yarn.lock
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ RUN mkdir /build && \
cp -R /source/admin /build/ && \
cp -R /source/api /build/ && \
cd /build/frontend && \
npm ci && npm run build && \
npm install && npm run build && \
cd /build/admin && \
npm ci && npm run build && \
npm install && npm run build && \
cd /build/api && \
npm install && \
cd /build && \
Expand All @@ -40,4 +40,4 @@ LABEL org.opencontainers.image.vendor="petio-team"
LABEL org.opencontainers.image.url="https://github.com/petio-team/petio"
LABEL org.opencontainers.image.documentation="https://github.com/petio-team/petio-docs/wiki"
LABEL org.opencontainers.image.licenses="MIT"
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "wget", "--spider", "http://localhost:7777" ]
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 CMD [ "wget", "--spider", "http://localhost:7777/health" ]
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ Configuring Petio is fairly straight forward but our docs cover the process, fro

<h2>Credits</h2>
<h4>Attribution Credits</h4>
<p><a target="_blank" href="https://www.themoviedb.org/"><img height="10px" src="https://www.themoviedb.org/assets/2/v4/logos/v2/blue_square_1-5bdc75aaebeb75dc7ae79426ddd9be3b2be1e342510f8202baf6bffa71d7f5c4.svg"/>The Movie Database (Data Source)</a></p>
<p><a target="_blank" href="https://fanart.tv/">Fanart.tv (Extra visual assets)</a></p>
<p><a target="_blank" href="https://https://fontawesome.com//">Fontawesome (SVG Icon Assets)</a></p>
<p><a target="_blank" href="https://www.themoviedb.org/"><img height="15px" src="https://www.themoviedb.org/assets/2/v4/logos/v2/blue_square_1-5bdc75aaebeb75dc7ae79426ddd9be3b2be1e342510f8202baf6bffa71d7f5c4.svg"/> The Movie Database (Data Source)</a></p>
<p><a target="_blank" href="https://fanart.tv/"><img height="15px" src="https://fanart.tv/wp-content/uploads/2020/08/cropped-logo-32x32.png"/> Fanart.tv (Extra visual assets)</a></p>
<p><a target="_blank" href="https://fontawesome.com/"><img height="15px" src="https://fontawesome.com/images/favicons/favicon-16x16.png"/> Font Awesome (SVG Icon Assets)</a></p>
<p><a target="_blank" href="https://www.imdb.com"><img height="15px" src="https://m.media-amazon.com/images/G/01/IMDb/BG_rectangle._CB1509060989_SY230_SX307_AL_.png"/> Information courtesy of IMDb. Used with permission.</a></p>

<h4>Special Thanks to:</h4>
<p><a target="_blank" href="https://github.com/vertig0ne">vertig0ne</a></p>
Expand Down
2 changes: 2 additions & 0 deletions admin/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

node_modules/
.eslintcache
package-lock.json
yarn.lock
17,080 changes: 0 additions & 17,080 deletions admin/package-lock.json

This file was deleted.

2 changes: 1 addition & 1 deletion admin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "petio-admin",
"version": "0.4.5-alpha",
"version": "0.5.1-alpha",
"private": true,
"homepage": ".",
"dependencies": {
Expand Down
6 changes: 4 additions & 2 deletions admin/src/components/FilterAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ class FilterAction extends React.Component {
onChange={this.props.inputChange}
value={item.profile}
>
{item.server && this.props.settings[item.server] ? (
{item.server &&
this.props.settings[item.server] &&
this.props.settings[item.server].profiles ? (
<>
<option value="">Please Select</option>
{this.props.settings[item.server].profiles.map(
Expand Down Expand Up @@ -141,7 +143,7 @@ class FilterAction extends React.Component {
value={item.tag}
>
{item.server && this.props.settings[item.server] ? (
this.props.settings[item.server].tags.length > 0 ? (
this.props.settings[item.server].tags ? (
<>
<option value="">Don&apos;t set tag</option>
{this.props.settings[item.server].tags.map((tag) => {
Expand Down
6 changes: 3 additions & 3 deletions admin/src/components/MovieCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class MovieCard extends React.Component {
this.getMovie();
}

componentDidUpdate() {
this.getMovie();
}
// componentDidUpdate() {
// this.getMovie();
// }

getMovie() {
let movie = this.props.movie;
Expand Down
30 changes: 29 additions & 1 deletion admin/src/components/RequestsTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,34 @@ class RequestsTable extends React.Component {
if (sortVal === "status") {
av = a.process_stage ? a.process_stage.message : 0;
bv = b.process_stage ? b.process_stage.message : 0;
if (
a.type === "movie" &&
a.children &&
a.process_stage.status === "blue"
) {
if (a.children[0].info.inCinemas) {
av = `__${a.children[0].info.inCinemas}`;
}
}
if (
b.type === "movie" &&
b.children &&
b.process_stage.status === "blue"
) {
if (b.children[0].info.inCinemas) {
bv = `__${b.children[0].info.inCinemas}`;
}
}
if (a.type === "tv" && a.children && a.process_stage.status === "blue") {
if (a.children[0].info.firstAired) {
av = `__${a.children[0].info.firstAired}`;
}
}
if (b.type === "tv" && b.children && b.process_stage.status === "blue") {
if (b.children[0].info.firstAired) {
bv = `__${b.children[0].info.firstAired}`;
}
}
}
if (!av) av = "";
if (!bv) bv = "";
Expand Down Expand Up @@ -149,7 +177,7 @@ class RequestsTable extends React.Component {
) : null}
<tr className="child">
<td>
{type === "tv" ? (
{type === "tv" && child.episode ? (
<p>
Series: {child.episode.seasonNumber} Episode:{" "}
{child.episode.episodeNumber}
Expand Down
14 changes: 7 additions & 7 deletions admin/src/components/SessionMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class SessionMedia extends React.Component {
}

componentDidUpdate() {
if (!this.props.live && !this.state.id && this.props.type !== "clip") {
if (this.props.type === "movie") {
this.getMovie();
} else {
this.getSeries();
}
}
// if (!this.props.live && !this.state.id && this.props.type !== "clip") {
// if (this.props.type === "movie") {
// this.getMovie();
// } else {
// this.getSeries();
// }
// }
}

getMovie() {
Expand Down
14 changes: 14 additions & 0 deletions admin/src/data/Api/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,20 @@ export function testDiscord() {
});
}

export function testTelegram() {
return new Promise((resolve, reject) => {
api
.testTelegram()
.then((data) => {
resolve(data);
})
.catch((err) => {
console.log(err);
reject();
});
});
}

export async function getUser(id) {
try {
let userData = await api.getUser(id);
Expand Down
4 changes: 4 additions & 0 deletions admin/src/data/Api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ export function testDiscord() {
return get(`/hooks/discord/test`);
}

export function testTelegram() {
return get(`/hooks/telegram/test`);
}

export async function getUser(id) {
return get(`/user/${id}`);
}
Expand Down
2 changes: 2 additions & 0 deletions admin/src/data/Api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
getFilters,
uploadThumb,
testDiscord,
testTelegram,
testPlex,
} from "./actions";

Expand Down Expand Up @@ -97,5 +98,6 @@ export default {
getFilters,
uploadThumb,
testDiscord,
testTelegram,
testPlex,
};
1 change: 1 addition & 0 deletions admin/src/data/Languages/languages.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ const languages = [
{ code: "om", name: "Oromo" },
{ code: "os", name: "Ossetian; Ossetic" },
{ code: "pi", name: "Pali" },
{ code: "pl", name: "Polish"},
{ code: "pt", name: "Portuguese" },
{ code: "qu", name: "Quechua" },
{ code: "rm", name: "Raeto-Romance" },
Expand Down
1 change: 0 additions & 1 deletion admin/src/page/Requests.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class Requests extends React.Component {
}

closeModal(id, clear = false) {
console.log(clear);
if (clear) {
this.setState({
[`${id}Open`]: false,
Expand Down
5 changes: 5 additions & 0 deletions admin/src/page/settings/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ class Filter extends React.Component {
if (target.dataset.row === "action") {
let actionRow = target.dataset.actionRow;
console.log(target.dataset);
if (!Array.isArray(current[target.dataset.item].action)) {
current[target.dataset.item].action = [
current[target.dataset.item].action,
];
}
current[target.dataset.item][target.dataset.row][actionRow][
name
] = value;
Expand Down
129 changes: 129 additions & 0 deletions admin/src/page/settings/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class General extends React.Component {
base_path: "",
login_type: false,
discord_webhook: false,
telegram_bot_token: "",
telegram_chat_id: "",
telegram_send_silently: false,
plexPopular: false,
token: false,
};
Expand All @@ -68,9 +71,11 @@ class General extends React.Component {
this.testEmail = this.testEmail.bind(this);
this.saveBasePath = this.saveBasePath.bind(this);
this.saveDiscord = this.saveDiscord.bind(this);
this.saveTelegram = this.saveTelegram.bind(this);
this.saveLoginType = this.saveLoginType.bind(this);
this.savePlexPopular = this.savePlexPopular.bind(this);
this.testDiscord = this.testDiscord.bind(this);
this.testTelegram = this.testTelegram.bind(this);
this.testPlex = this.testPlex.bind(this);
}

Expand Down Expand Up @@ -151,6 +156,26 @@ class General extends React.Component {
}
}

async saveTelegram() {
try {
await Api.updateConfig({
telegram_bot_token: this.state.telegram_bot_token,
telegram_chat_id: this.state.telegram_chat_id,
telegram_send_silently: this.state.telegram_send_silently,
});
this.props.msg({
message: "Telegram Chat Config Saved",
type: "good",
});
} catch (err) {
console.log(err);
this.props.msg({
message: "Failed to Save Telegram Chat Config",
type: "error",
});
}
}

async saveLoginType() {
try {
await Api.updateConfig({
Expand Down Expand Up @@ -202,6 +227,15 @@ class General extends React.Component {
base_path: config.base_path ? config.base_path : "",
login_type: config.login_type ? config.login_type : 1,
discord_webhook: config.discord_webhook ? config.discord_webhook : "",
telegram_bot_token: config.telegram_bot_token
? config.telegram_bot_token
: "",
telegram_chat_id: config.telegram_chat_id
? config.telegram_chat_id
: "",
telegram_send_silently: config.telegram_send_silently
? config.telegram_send_silently
: false,
plexPopular:
config.plexPopular === null || config.plexPopular === undefined
? true
Expand Down Expand Up @@ -244,6 +278,30 @@ class General extends React.Component {
}
}

async testTelegram() {
try {
await this.saveTelegram();
let test = await Api.testTelegram();
if (test.result) {
this.props.msg({
message: "Telegram Test Passed!",
type: "good",
});
} else {
this.props.msg({
message: "Telegram Test Failed",
type: "error",
});
}
} catch (err) {
console.log(err);
this.props.msg({
message: "Telegram Test Failed",
type: "error",
});
}
}

async testEmail() {
try {
await this.saveEmail();
Expand Down Expand Up @@ -522,6 +580,77 @@ class General extends React.Component {
Test
</button>
</section>
<section>
<p className="main-title mb--2">Telegram</p>
<p className="description">
Please enter here your Telegram chat config. You can find
documentation about Telegram&apos;s bot on{" "}
<a
href="https://core.telegram.org/bots"
target="_blank"
rel="noreferrer"
>
Telegram documentation
</a>
.
</p>
<label>Bot token</label>
<input
type="text"
name="telegram_bot_token"
value={this.state.telegram_bot_token}
onChange={this.inputChange}
autoCorrect="off"
spellCheck="off"
/>
<label>Chat ID</label>
<input
type="text"
name="telegram_chat_id"
value={this.state.telegram_chat_id}
onChange={this.inputChange}
autoCorrect="off"
spellCheck="off"
/>
<p className="description">
You must start a conversation with the bot or add it to your group
to receive messages.
<br />
<a
target="_blank"
href="http://stackoverflow.com/a/37396871/882971"
rel="noreferrer"
>
More Info
</a>
</p>
<div className="checkbox-wrap mb--2">
<input
type="checkbox"
name="telegram_send_silently"
checked={this.state.telegram_send_silently}
onChange={this.inputChange}
/>
<p>Send silently (notification with no sound)</p>
</div>
<button
style={{ marginRight: "10px" }}
className="btn btn__square"
onClick={this.saveTelegram}
>
Save
</button>
<button
className={`btn btn__square ${
this.state.telegram_bot_token && this.state.telegram_chat_id
? ""
: "disabled"
}`}
onClick={this.testTelegram}
>
Test
</button>
</section>
<section>
<p className="main-title mb--2">Popular content on Plex</p>
<p className="description">
Expand Down
Loading

0 comments on commit 0aeef82

Please sign in to comment.