Skip to content

Commit

Permalink
Merge pull request #343 from Hamster45105/auto-repond
Browse files Browse the repository at this point in the history
Inform users of app criteria
  • Loading branch information
ImranR98 authored Dec 12, 2024
2 parents 84922ea + 55cec60 commit 85cc990
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .github/discussion_auto_response.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
**Hello**,

Thanks for opening an app request! Please ensure you have read the [app criteria](https://github.com/ImranR98/apps.obtainium.imranr.dev/blob/main/APP_CRITERIA.md) to confirm that the app you are requesting is suitable for this site. If you haven’t done so already, give it a read now.

If you realise the app you want is not suitable, please close the discussion.

If you choose to leave a request for an unsuitable app open, it may be ignored.

<details>
<summary><i>Deutsch</i></summary>

**Hallo**,

vielen Dank, dass Sie eine App-Anfrage gestellt haben! Bitte vergewissern Sie sich, dass Sie die [App-Kriterien](https://github.com/ImranR98/apps.obtainium.imranr.dev/blob/main/APP_CRITERIA.md) gelesen haben, um die Eignung der von Ihnen angefragten App-Konfiguration für diese Website zu überprüfen. Falls Sie dies noch nicht getan haben, lesen Sie bitte die Kriterien jetzt sorgfältig durch.

Wenn Sie feststellen, dass die von Ihnen gewünschte App nicht geeignet ist, schließen Sie bitte die Diskussion.

Wenn Sie eine Anfrage für eine ungeeignete App offen lassen, wird sie ignoriert werden.
</details>
41 changes: 41 additions & 0 deletions .github/workflows/discussion_auto_response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Auto Respond to App Requests

on:
discussion:
types: [created]

permissions:
contents: read
discussions: write

jobs:
respond:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Post response comment
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const RESPONSE_CONTENT = fs.readFileSync('.github/discussion_auto_response.md', 'utf8');
const discussionId = context.payload.discussion.node_id;
const categoryName = context.payload.discussion.category.name;
if (categoryName === 'App Requests') {
const query = `
mutation($discussionId: ID!, $body: String!) {
addDiscussionComment(input: {discussionId: $discussionId, body: $body}) {
comment {
id
}
}
}
`;
await github.graphql(query, {
discussionId: discussionId,
body: RESPONSE_CONTENT
});
}
18 changes: 9 additions & 9 deletions data/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@
"en": "Important – Please Read!",
"de": "Wichtig - Bitte beachten!"
},
"modalBody1": {
"en": "This website is used for configs that people may find difficult to create. If the app you are requesting can be added to Obtainium in one click after entering it's source link (leaving all other settings as default), than the app IS NOT suitable for this website.",
"de": "Diese Website wird für Konfigurationen verwendet, deren Erstellung für viele Menschen schwierig ist. Falls die von dir angefragte App mit einem Klick zu Obtainium hinzugefügt werden kann, sobald du den Quelllink eingegeben hast (und alle anderen Einstellungen voreingestellt bleiben), dann ist die App NICHT für diese Website geeignet."
"modalAcceptButtonBefore": {
"en": "I have read an understand the",
"de": "Ich habe die"
},
"modalBody2": {
"en": "At a minimum, when making your request, you must provide a link to the app download page and any configs/things you have tried to get the app working so far. Please have a go at adding it yourself before requesting.",
"de": "Wenn du eine Anfrage stellst, musst du zumindest einen Link zur Download-Seite der App angeben und alle Konfigurationen/Dinge, die du bisher ausprobiert hast, damit die App funktioniert mitteilen. Bitte versuche, die App selbst hinzuzufügen, bevor du eine Anfrage stellst."
"appCriteria": {
"en": "app criteria",
"de": "App-Kriterein"
},
"modalAcceptButton": {
"en": "I have read understand the above information and understand that if I have not followed the above insturctions, my request may be ignored.",
"de": "Ich habe die obigen Informationen gelesen und verstanden, dass mein Antrag ignoriert wird, wenn ich die obigen Hinweise nicht beachtet habe."
"modalAcceptButtonAfter": {
"en": "",
"de": "gelesen und verstanden"
},
"modalButtonText": {
"en": "Continue",
Expand Down
13 changes: 6 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ <h1 class="title" id="title">Obtainium Apps</h1>
<button class="delete" aria-label="close" onclick="toggleModal()"></button>
</header>
<section class="modal-card-body">
<p id="modal-body-1">This website is used for configs that people may find difficult to create. If the app you are requesting can be added to Obtainium in one click after entering it's source link (leaving all other settings as default), than the app IS NOT suitable for this website.</p>
<br>
<p id="modal-body-2">At a minimum, when making your request, you must provide a link to the app download page and any configs/things you have tried to get the app working so far. Please have a go at adding it yourself before requesting.</p>
<br>
<div class="field">
<input type="checkbox" id="accept-button" onclick="toggleContinueButton()">
<label for="accept-button">I have read and understand the above information and understand that if I have not followed the above instructions, my request may be ignored</label>
</div>
<input type="checkbox" id="accept-button" onclick="toggleContinueButton()" style="width: 15px; height: 15px;" unchecked>
<label for="accept-button">
<span id="modal-accept-button-text-1">I have read an understand the</span>
<a id="app-criteria" href="https://github.com/ImranR98/apps.obtainium.imranr.dev/blob/main/APP_CRITERIA.md" style="font-size: 1.2em;">app criteria</a>
<span id="modal-accept-button-text-2"></span>
</label>
</section>
<footer class="modal-card-foot">
<a href="https://github.com/ImranR98/apps.obtainium.imranr.dev/discussions/new?category=app-requests" class="button is-primary is-hidden" id="modal-button" style="width: 100%; display: flex; justify-content: center; align-items: center;">Continue →</a>
Expand Down
6 changes: 3 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ function render() {
document.querySelector('#subtitle').innerHTML = getString('subtitle')
document.querySelector('#request-apps').innerHTML = getString('requestAppsButton')
document.querySelector('#modal-title').innerHTML = getString('modalTitle')
document.querySelector('#modal-body-1').innerHTML = getString('modalBody1')
document.querySelector('#modal-body-2').innerHTML = getString('modalBody2')
document.querySelector('#accept-button').innerHTML = getString('modalAcceptButton')
document.querySelector('#modal-accept-button-text-1').innerHTML = getString('modalAcceptButtonBefore')
document.querySelector('#app-criteria').textContent = getString('appCriteria')
document.querySelector('#modal-accept-button-text-2').innerHTML = getString('modalAcceptButtonAfter')
document.querySelector('#modal-button').innerHTML = getString('modalButtonText') + " →"
}

Expand Down

0 comments on commit 85cc990

Please sign in to comment.