diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index cd3c2574..250734cd 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,8 +1,8 @@ blank_issues_enabled: false contact_links: - - name: Report provider bug + - name: Request a new provider or report bug with an existing provider url: https://github.com/recloudstream - about: Please do not report any provider bugs here. This repository does not contain any providers. Please find the appropriate repository and report your issue there or join the discord. + about: Please do not report any provider bugs here or request new providers. This repository does not contain any providers. Please find the appropriate repository and report your issue there or join the discord. - name: Discord url: https://discord.gg/5Hus6fM about: Join our discord for faster support on smaller issues. diff --git a/.github/downloads.jpg b/.github/downloads.jpg index 0b671edc..ca14a664 100644 Binary files a/.github/downloads.jpg and b/.github/downloads.jpg differ diff --git a/.github/home.jpg b/.github/home.jpg index 2ccfaff4..72370d3c 100644 Binary files a/.github/home.jpg and b/.github/home.jpg differ diff --git a/.github/locales.py b/.github/locales.py new file mode 100644 index 00000000..e95ec902 --- /dev/null +++ b/.github/locales.py @@ -0,0 +1,47 @@ +import re +import glob +import requests + + +SETTINGS_PATH = "app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsGeneral.kt" +START_MARKER = "/* begin language list */" +END_MARKER = "/* end language list */" +XML_NAME = "app/src/main/res/values-" +ISO_MAP_URL = "https://gist.githubusercontent.com/Josantonius/b455e315bc7f790d14b136d61d9ae469/raw" +INDENT = " "*4 + +iso_map = requests.get(ISO_MAP_URL, timeout=300).json() + +# Load settings file +src = open(SETTINGS_PATH, "r", encoding='utf-8').read() +before_src, rest = src.split(START_MARKER) +rest, after_src = rest.split(END_MARKER) + +# Load already added langs +languages = {} +for lang in re.finditer(r'Triple\("(.*)", "(.*)", "(.*)"\)', rest): + flag, name, iso = lang.groups() + languages[iso] = (flag, name) + +# Add not yet added langs +for folder in glob.glob(f"{XML_NAME}*"): + iso = folder[len(XML_NAME):] + if iso not in languages.keys(): + languages[iso] = ("", iso_map.get(iso.lower(),iso)) + +# Create triples +triples = [] +for iso in sorted(languages.keys()): + flag, name = languages[iso] + triples.append(f'{INDENT}Triple("{flag}", "{name}", "{iso}"),') + +# Update settings file +open(SETTINGS_PATH, "w+",encoding='utf-8').write( + before_src + + START_MARKER + + "\n" + + "\n".join(triples) + + "\n" + + END_MARKER + + after_src +) \ No newline at end of file diff --git a/.github/player.jpg b/.github/player.jpg index 0580fb03..f6959cf3 100644 Binary files a/.github/player.jpg and b/.github/player.jpg differ diff --git a/.github/results.jpg b/.github/results.jpg index 5e63169f..4dbc9b8d 100644 Binary files a/.github/results.jpg and b/.github/results.jpg differ diff --git a/.github/search.jpg b/.github/search.jpg index 998b7753..784bec89 100644 Binary files a/.github/search.jpg and b/.github/search.jpg differ diff --git a/.github/workflows/build_to_archive.yml b/.github/workflows/build_to_archive.yml new file mode 100644 index 00000000..83430766 --- /dev/null +++ b/.github/workflows/build_to_archive.yml @@ -0,0 +1,76 @@ +name: Archive build + +on: + push: + branches: [ master ] + paths-ignore: + - '*.md' + - '*.json' + - '**/wcokey.txt' + workflow_dispatch: + +concurrency: + group: "Archive-build" + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Generate access token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_KEY }} + repository: "recloudstream/secrets" + - name: Generate access token (archive) + id: generate_archive_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_KEY }} + repository: "recloudstream/cloudstream-archive" + - uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Fetch keystore + id: fetch_keystore + run: | + TMP_KEYSTORE_FILE_PATH="${RUNNER_TEMP}"/keystore + mkdir -p "${TMP_KEYSTORE_FILE_PATH}" + curl -H "Authorization: token ${{ steps.generate_token.outputs.token }}" -o "${TMP_KEYSTORE_FILE_PATH}/prerelease_keystore.keystore" "https://raw.githubusercontent.com/recloudstream/secrets/master/keystore.jks" + curl -H "Authorization: token ${{ steps.generate_token.outputs.token }}" -o "keystore_password.txt" "https://raw.githubusercontent.com/recloudstream/secrets/master/keystore_password.txt" + KEY_PWD="$(cat keystore_password.txt)" + echo "::add-mask::${KEY_PWD}" + echo "key_pwd=$KEY_PWD" >> $GITHUB_OUTPUT + - name: Run Gradle + run: | + ./gradlew assemblePrerelease + env: + SIGNING_KEY_ALIAS: "key0" + SIGNING_KEY_PASSWORD: ${{ steps.fetch_keystore.outputs.key_pwd }} + SIGNING_STORE_PASSWORD: ${{ steps.fetch_keystore.outputs.key_pwd }} + - uses: actions/checkout@v3 + with: + repository: "recloudstream/cloudstream-archive" + token: ${{ steps.generate_archive_token.outputs.token }} + path: "archive" + + - name: Move build + run: | + cp app/build/outputs/apk/prerelease/release/*.apk "archive/$(git rev-parse --short HEAD).apk" + + - name: Push archive + run: | + cd $GITHUB_WORKSPACE/archive + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + git add . + git commit --amend -m "Build $GITHUB_SHA" || exit 0 # do not error if nothing to commit + git push --force \ No newline at end of file diff --git a/.github/workflows/generate_dokka.yml b/.github/workflows/generate_dokka.yml index 032ea8d0..3c5caad7 100644 --- a/.github/workflows/generate_dokka.yml +++ b/.github/workflows/generate_dokka.yml @@ -39,9 +39,8 @@ jobs: - name: Clean old builds run: | - shopt -s extglob cd $GITHUB_WORKSPACE/dokka/ - rm -rf !(.git) + rm -rf "./-cloudstream" - name: Setup JDK 11 uses: actions/setup-java@v1 diff --git a/.github/workflows/issue-action.yml b/.github/workflows/issue_action.yml similarity index 93% rename from .github/workflows/issue-action.yml rename to .github/workflows/issue_action.yml index bfcb10d0..28b737b3 100644 --- a/.github/workflows/issue-action.yml +++ b/.github/workflows/issue_action.yml @@ -1,63 +1,63 @@ -name: Issue automatic actions - -on: - issues: - types: [opened, edited] - -jobs: - issue-moderator: - runs-on: ubuntu-latest - steps: - - name: Generate access token - id: generate_token - uses: tibdex/github-app-token@v1 - with: - app_id: ${{ secrets.GH_APP_ID }} - private_key: ${{ secrets.GH_APP_KEY }} - - name: Similarity analysis - uses: actions-cool/issues-similarity-analysis@v1 - with: - token: ${{ steps.generate_token.outputs.token }} - filter-threshold: 0.5 - title-excludes: '' - comment-title: | - ### Your issue looks similar to these issues: - Please close if duplicate. - comment-body: '${index}. ${similarity} #${number}' - - uses: actions/checkout@v2 - - name: Automatically close issues that dont follow the issue template - uses: lucasbento/auto-close-issues@v1.0.2 - with: - github-token: ${{ steps.generate_token.outputs.token }} - issue-close-message: | - @${issue.user.login}: hello! :wave: - This issue is being automatically closed because it does not follow the issue template." - closed-issues-label: "invalid" - - name: Check if issue mentions a provider - id: provider_check - env: - GH_TEXT: "${{ github.event.issue.title }} ${{ github.event.issue.body }}" - run: | - wget --output-document check_issue.py "https://raw.githubusercontent.com/recloudstream/.github/master/.github/check_issue.py" - pip3 install httpx - RES="$(python3 ./check_issue.py)" - echo "::set-output name=name::${RES}" - - name: Comment if issue mentions a provider - if: steps.provider_check.outputs.name != 'none' - uses: actions-cool/issues-helper@v3 - with: - actions: 'create-comment' - token: ${{ steps.generate_token.outputs.token }} - body: | - Hello ${{ github.event.issue.user.login }}. - Please do not report any provider bugs here. This repository does not contain any providers. Please find the appropriate repository and report your issue there or join the [discord](https://discord.gg/5Hus6fM). - - Found provider name: `${{ steps.provider_check.outputs.name }}` - - name: Add eyes reaction to all issues - uses: actions-cool/emoji-helper@v1.0.0 - with: - type: 'issue' - token: ${{ steps.generate_token.outputs.token }} - emoji: 'eyes' - - +name: Issue automatic actions + +on: + issues: + types: [opened] + +jobs: + issue-moderator: + runs-on: ubuntu-latest + steps: + - name: Generate access token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_KEY }} + - name: Similarity analysis + uses: actions-cool/issues-similarity-analysis@v1 + with: + token: ${{ steps.generate_token.outputs.token }} + filter-threshold: 0.60 + title-excludes: '' + comment-title: | + ### Your issue looks similar to these issues: + Please close if duplicate. + comment-body: '${index}. ${similarity} #${number}' + - uses: actions/checkout@v2 + - name: Automatically close issues that dont follow the issue template + uses: lucasbento/auto-close-issues@v1.0.2 + with: + github-token: ${{ steps.generate_token.outputs.token }} + issue-close-message: | + @${issue.user.login}: hello! :wave: + This issue is being automatically closed because it does not follow the issue template." + closed-issues-label: "invalid" + - name: Check if issue mentions a provider + id: provider_check + env: + GH_TEXT: "${{ github.event.issue.title }} ${{ github.event.issue.body }}" + run: | + wget --output-document check_issue.py "https://raw.githubusercontent.com/recloudstream/.github/master/.github/check_issue.py" + pip3 install httpx + RES="$(python3 ./check_issue.py)" + echo "name=${RES}" >> $GITHUB_OUTPUT + - name: Comment if issue mentions a provider + if: steps.provider_check.outputs.name != 'none' + uses: actions-cool/issues-helper@v3 + with: + actions: 'create-comment' + token: ${{ steps.generate_token.outputs.token }} + body: | + Hello ${{ github.event.issue.user.login }}. + Please do not report any provider bugs here. This repository does not contain any providers. Please find the appropriate repository and report your issue there or join the [discord](https://discord.gg/5Hus6fM). + + Found provider name: `${{ steps.provider_check.outputs.name }}` + - name: Add eyes reaction to all issues + uses: actions-cool/emoji-helper@v1.0.0 + with: + type: 'issue' + token: ${{ steps.generate_token.outputs.token }} + emoji: 'eyes' + + diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml index 71301e25..4ce7dba1 100644 --- a/.github/workflows/prerelease.yml +++ b/.github/workflows/prerelease.yml @@ -40,12 +40,10 @@ jobs: curl -H "Authorization: token ${{ steps.generate_token.outputs.token }}" -o "keystore_password.txt" "https://raw.githubusercontent.com/recloudstream/secrets/master/keystore_password.txt" KEY_PWD="$(cat keystore_password.txt)" echo "::add-mask::${KEY_PWD}" - echo "::set-output name=key_pwd::$KEY_PWD" + echo "key_pwd=$KEY_PWD" >> $GITHUB_OUTPUT - name: Run Gradle run: | - ./gradlew assemblePrerelease - ./gradlew androidSourcesJar - ./gradlew makeJar + ./gradlew assemblePrerelease makeJar androidSourcesJar env: SIGNING_KEY_ALIAS: "key0" SIGNING_KEY_PASSWORD: ${{ steps.fetch_keystore.outputs.key_pwd }} @@ -55,9 +53,9 @@ jobs: with: repo_token: "${{ secrets.GITHUB_TOKEN }}" automatic_release_tag: "pre-release" - prerelease: false + prerelease: true title: "Pre-release Build" files: | - app/build/outputs/apk/prerelease/*.apk + app/build/outputs/apk/prerelease/release/*.apk app/build/libs/app-sources.jar app/build/classes.jar diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 1a4db134..36199cd6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -15,9 +15,9 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Run Gradle - run: ./gradlew assembleDebug + run: ./gradlew assemblePrereleaseDebug - name: Upload Artifact uses: actions/upload-artifact@v2 with: name: pull-request-build - path: "app/build/outputs/apk/debug/*.apk" + path: "app/build/outputs/apk/prerelease/debug/*.apk" diff --git a/.github/workflows/update_locales.yml b/.github/workflows/update_locales.yml new file mode 100644 index 00000000..93cdca44 --- /dev/null +++ b/.github/workflows/update_locales.yml @@ -0,0 +1,39 @@ +name: Update locale lists + +on: + workflow_dispatch: + push: + paths: + - '**.xml' + branches: + - master + +concurrency: + group: "locale-list" + cancel-in-progress: true + +jobs: + create: + runs-on: ubuntu-latest + steps: + - name: Generate access token + id: generate_token + uses: tibdex/github-app-token@v1 + with: + app_id: ${{ secrets.GH_APP_ID }} + private_key: ${{ secrets.GH_APP_KEY }} + repository: "recloudstream/cloudstream" + - uses: actions/checkout@v2 + with: + token: ${{ steps.generate_token.outputs.token }} + - name: Edit files + run: | + python3 .github/locales.py + - name: Commit to the repo + run: | + git config --local user.email "111277985+recloudstream[bot]@users.noreply.github.com" + git config --local user.name "recloudstream[bot]" + git add . + # "echo" returns true so the build succeeds, even if no changed files + git commit -m 'update list of locales' || echo + git push diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml index 652d9f3f..333d4937 100644 --- a/.idea/jarRepositories.xml +++ b/.idea/jarRepositories.xml @@ -31,5 +31,10 @@