Skip to content

Commit

Permalink
Release: Nightly 5.4.7
Browse files Browse the repository at this point in the history
- Remove mac build (not working)
- Fix hianime/aniwatch subtitle
  • Loading branch information
amarullz committed Dec 14, 2024
1 parent 1d69bfd commit b4390fc
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 69 deletions.
45 changes: 23 additions & 22 deletions .github/workflows/nightly-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ jobs:
release_desktop:
strategy:
matrix:
platform: [ windows-latest, ubuntu-latest, macos-latest, macos-13]
platform: [ windows-latest, ubuntu-latest]
# platform: [ windows-latest, ubuntu-latest, macos-latest, macos-13]
runs-on: ${{ matrix.platform }}
if: startsWith(github.event.head_commit.message, 'Release:')
steps:
Expand Down Expand Up @@ -39,27 +40,27 @@ jobs:
- name: Install app dependencies
run: npm install

- name: Build app (MacOS - arm64)
if: matrix.platform == 'macos-latest'
run: npm run build-mac

- name: Upload build (MacOS - arm64)
uses: actions/upload-artifact@v4
if: matrix.platform == 'macos-latest'
with:
name: animetv-mac-arm64.dmg
path: ./electron/builds/animetv-darwin-arm64/*.dmg

- name: Build app (MacOS - x64)
if: matrix.platform == 'macos-13'
run: npm run build-mac-x64

- name: Upload build (MacOS - x64)
uses: actions/upload-artifact@v4
if: matrix.platform == 'macos-13'
with:
name: animetv-mac-x64.dmg
path: ./electron/builds/animetv-darwin-x64/*.dmg
# - name: Build app (MacOS - arm64)
# if: matrix.platform == 'macos-latest'
# run: npm run build-mac

# - name: Upload build (MacOS - arm64)
# uses: actions/upload-artifact@v4
# if: matrix.platform == 'macos-latest'
# with:
# name: animetv-mac-arm64.dmg
# path: ./electron/builds/animetv-darwin-arm64/*.dmg

# - name: Build app (MacOS - x64)
# if: matrix.platform == 'macos-13'
# run: npm run build-mac-x64

# - name: Upload build (MacOS - x64)
# uses: actions/upload-artifact@v4
# if: matrix.platform == 'macos-13'
# with:
# name: animetv-mac-x64.dmg
# path: ./electron/builds/animetv-darwin-x64/*.dmg

- name: Build app (Windows - x64)
if: matrix.platform == 'windows-latest'
Expand Down
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
minSdk 22
targetSdk 34
versionCode 540
versionName "5.4.6-Nightly"
versionName "5.4.7-Nightly"


// Automatic Build Version
Expand Down
88 changes: 49 additions & 39 deletions app/src/main/assets/view/m.js
Original file line number Diff line number Diff line change
Expand Up @@ -8187,50 +8187,60 @@ const pb={
dt.ep_stream_sel = seld;
var subld = dt.ep_servers[subut][subuid];
console.log("GOT-VIDEO-IFRAME-URL : "+seld.link);
console.log("GOT-SUB-URL : "+subld.link);
console.log("GOT-SUB-URL : "+subld.link+" LOAD SUB: "+loadSubtitle);

// Get Video Data
if (loadSubtitle){
var vvturl='https://'+seld.dns+'/embed-2/ajax/e-1/getSources?id='+enc(subld.sid);
$ap(vvturl,function(r){
if (r.ok){
try{
var jv=JSON.parse(r.responseText);
/* Load Intro / Outro */
try{
var st=jv.intro.start;
var en=jv.intro.end;
var sto=jv.outro.start;
var eno=jv.outro.end;
dt.skip=[
[st?st:0,en?en:0],
[sto?sto:0,eno?eno:0]
];
}catch(e){}

/* Load Subtitle */
vtt.clear();
pb.subtitles=[];
window.__subtitle=pb.subtitles;
try{
if (jv.tracks){
var n=jv.tracks.length;
for (var i=0;i<n;i++){
var tk=jv.tracks[i];
if (tk.kind=='captions'){
pb.subtitles.push({
u:tk.file,
d:tk.default?1:0,
l:(tk.label+'').toLowerCase().trim()
});
function initSubtitle(){
$a('/__cache_subtitle?t='+$tick(),function(r){
if (r.ok){
if (r.responseText){
try{
var jv=JSON.parse(r.responseText);
/* Load Intro / Outro */
try{
var st=jv.intro.start;
var en=jv.intro.end;
var sto=jv.outro.start;
var eno=jv.outro.end;
dt.skip=[
[st?st:0,en?en:0],
[sto?sto:0,eno?eno:0]
];
}catch(e){}

/* Load Subtitle */
vtt.clear();
pb.subtitles=[];
window.__subtitle=pb.subtitles;
try{
if (jv.tracks){
var n=jv.tracks.length;
for (var i=0;i<n;i++){
var tk=jv.tracks[i];
if (tk.kind=='captions'){
pb.subtitles.push({
u:tk.file,
d:tk.default?1:0,
l:(tk.label+'').toLowerCase().trim()
});
}
}
vtt.init(pb.subtitles);
}
}
vtt.init(pb.subtitles);
}
}catch(e){}
}catch(ee){}
}
}catch(e){}
}catch(ee){}
}
else{
setTimeout(initSubtitle,500);
}
}
});
}
$a('/__cache_subtitle/clear?t='+$tick(),function(r){
setTimeout(initSubtitle,500);
});

}
cb();
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,16 @@
import com.devbrackets.android.exomedia.nmp.config.PlayerConfigBuilder;
import com.devbrackets.android.exomedia.nmp.manager.track.TrackManager;
import com.google.common.base.Charsets;
import com.google.common.io.CharStreams;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
Expand Down Expand Up @@ -122,6 +125,8 @@
public boolean webViewReady=false;
public static boolean USE_WEB_VIEW_ASSETS=false;

public String sourceCacheString = "";

public AudioManager audioManager;

public int sysBrightness;
Expand Down Expand Up @@ -912,6 +917,19 @@ public WebResourceResponse shouldInterceptRequest(final WebView view,
}
return aApi.assetsRequest(uri.getPath().substring(3));
}
else if (path.startsWith("/__cache_subtitle")){
String out="";
if (path.startsWith("/__cache_subtitle/clear")) {
out = "OK";
sourceCacheString = "";
}
else{
out=sourceCacheString;
}
InputStream stream =
new ByteArrayInputStream(out.getBytes(StandardCharsets.UTF_8));
return new WebResourceResponse("text/plain", "UTF-8", stream);
}
else if (path.startsWith("/__proxy/")){
/* Proxy */
try {
Expand Down Expand Up @@ -1064,6 +1082,21 @@ else if (host.contains(Conf.STREAM_DOMAIN3)||host.contains(Conf.STREAM_DOMAIN4))
if (accept.startsWith("text/css")){ // ||accept.startsWith("image/")){
return aApi.badRequest;
}

// sourceCacheString
if (path.contains("/getSources")){
WebResourceResponse res = aApi.defaultRequest(view,request);
String result = "";
try {
result = CharStreams.toString(new InputStreamReader(res.getData(),Charsets.UTF_8));
sourceCacheString=result;
} catch (Exception ignored) {}
Log.d(_TAG, "CACHE VALUE =" + result);
InputStream stream =
new ByteArrayInputStream(result.getBytes(StandardCharsets.UTF_8));
res.setData(stream);
return res;
}
return aApi.defaultRequest(view,request);
}
else if (host.equals(Conf.SOURCE_DOMAIN5_API)){
Expand Down
32 changes: 25 additions & 7 deletions electron/src/libs/intercept.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ const intercept={
]
},

getsource_cache:"",

/* init constant strings & register protocol */
playerInjectString:"",
youtubeInjectString:"",
Expand Down Expand Up @@ -274,6 +276,20 @@ const intercept={
return net.fetch(common.viewRequest(p));
}

else if (url.pathname.startsWith('/__cache_subtitle')){
if (url.pathname.startsWith('/__cache_subtitle/clear')){
intercept.getsource_cache="";
console.log("CLEAR CACHE SUBTITLE = "+url);
return new Response("OK", {
status: 200
});
}
console.log("GET CACHE SUBTITLE = "+url);
return new Response(intercept.getsource_cache, {
status: 200
});
}

/* UI Player */
else if (url.pathname.startsWith("/__ui/")) {
var p = url.pathname.substring(6);
Expand Down Expand Up @@ -378,21 +394,23 @@ const intercept={
if (accept && (accept.startsWith("text/css"))) { /*||accept.startsWith("image/"))){*/
return intercept.fetchError();
}

if (url.pathname.indexOf('/embed-')>-1){
req.headers.set("Referer","https://hianime.to/");
console.log("EMBED = "+url);
}
if (url.pathname.indexOf('/getSources')>-1){
console.log("SOURCES = "+url);

let f=intercept.fetchNormal(req);
let body=await (await f).text();
console.log(body);
intercept.getsource_cache=body;
// return new Response(body, {
// status: f.status,
// headers: f.headers
// });
return intercept.fetchNormal(req);
}

// console.log("GET SORCES = "+url);
// let f=intercept.fetchStream(req);
// let body=await (await f).text();
// console.log(body);
// }
return intercept.fetchStream(req);
}

Expand Down

0 comments on commit b4390fc

Please sign in to comment.