Merge branch 'dev' into notify

This commit is contained in:
0xboobface 2018-12-03 14:35:24 +01:00
commit 0121e02edb
13 changed files with 52 additions and 24 deletions

View File

@ -1,11 +1,16 @@
1.12.2 1.13.0
======================== ========================
* Fix: Player not starting when path contains spaces * Added possibility to open small live previews of online models
int the Recording tab
* Added setting to toggle "Player Starting" message * Added setting to toggle "Player Starting" message
* Added possibility to add models by their URL * Added possibility to add models by their URL
* Added pause / resume all buttons * Added pause / resume all buttons
* Setting to define the base URL for MFC and CTB
* The paused checkbox are now clickable
* Implemented multi-selection for Recording and Recordings tab * Implemented multi-selection for Recording and Recordings tab
* Fix: Don't throw exceptions for unknown attributes in PlaylistParser
* Fix: Don't do space check, if minimum is set to 0 * Fix: Don't do space check, if minimum is set to 0
* Fix: Player not starting when path contains spaces
1.12.1 1.12.1
======================== ========================

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>1.12.1</version> <version>1.13.0</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>

View File

@ -26,6 +26,7 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
GridPane layout = SettingsTab.createGridLayout(); GridPane layout = SettingsTab.createGridLayout();
layout.add(new Label("MyFreeCams User"), 0, 0); layout.add(new Label("MyFreeCams User"), 0, 0);
TextField username = new TextField(Config.getInstance().getSettings().mfcUsername); TextField username = new TextField(Config.getInstance().getSettings().mfcUsername);
username.setPrefWidth(300);
username.textProperty().addListener((ob, o, n) -> { username.textProperty().addListener((ob, o, n) -> {
Config.getInstance().getSettings().mfcUsername = username.getText(); Config.getInstance().getSettings().mfcUsername = username.getText();
save(); save();
@ -47,13 +48,27 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
GridPane.setColumnSpan(password, 2); GridPane.setColumnSpan(password, 2);
layout.add(password, 1, 1); layout.add(password, 1, 1);
layout.add(new Label("MyFreeCams Base URL"), 0, 2);
TextField baseUrl = new TextField();
baseUrl.setText(Config.getInstance().getSettings().mfcBaseUrl);
baseUrl.textProperty().addListener((ob, o, n) -> {
Config.getInstance().getSettings().mfcBaseUrl = baseUrl.getText();
save();
});
GridPane.setFillWidth(baseUrl, true);
GridPane.setHgrow(baseUrl, Priority.ALWAYS);
GridPane.setColumnSpan(baseUrl, 2);
layout.add(baseUrl, 1, 2);
Button createAccount = new Button("Create new Account"); Button createAccount = new Button("Create new Account");
createAccount.setOnAction((e) -> DesktopIntegration.open(myFreeCams.getAffiliateLink())); createAccount.setOnAction((e) -> DesktopIntegration.open(myFreeCams.getAffiliateLink()));
layout.add(createAccount, 1, 2); layout.add(createAccount, 1, 3);
GridPane.setColumnSpan(createAccount, 2); GridPane.setColumnSpan(createAccount, 2);
GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN)); GridPane.setMargin(username, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN)); GridPane.setMargin(password, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(baseUrl, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
GridPane.setMargin(createAccount, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN)); GridPane.setMargin(createAccount, new Insets(0, 0, 0, SettingsTab.CHECKBOX_MARGIN));
return layout; return layout;
} }
} }

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>1.12.1</version> <version>1.13.0</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>

View File

@ -48,6 +48,7 @@ public class Settings {
public String bongaPassword = ""; public String bongaPassword = "";
public String mfcUsername = ""; public String mfcUsername = "";
public String mfcPassword = ""; public String mfcPassword = "";
public String mfcBaseUrl = "https://www.myfreecams.com";
public String camsodaUsername = ""; public String camsodaUsername = "";
public String camsodaPassword = ""; public String camsodaPassword = "";
public String cam4Username; public String cam4Username;

View File

@ -240,7 +240,7 @@ public class Chaturbate extends AbstractSite {
.add("bandwidth", "high") .add("bandwidth", "high")
.build(); .build();
Request req = new Request.Builder() Request req = new Request.Builder()
.url("https://chaturbate.com/get_edge_hls_url_ajax/") .url(getBaseUrl() + "/get_edge_hls_url_ajax/")
.post(body) .post(body)
.addHeader("X-Requested-With", "XMLHttpRequest") .addHeader("X-Requested-With", "XMLHttpRequest")
.build(); .build();

View File

@ -17,13 +17,14 @@ import okhttp3.Response;
public class MyFreeCams extends AbstractSite { public class MyFreeCams extends AbstractSite {
public static final String BASE_URI = "https://www.myfreecams.com"; static String baseUrl = "https://www.myfreecams.com";
private MyFreeCamsClient client; private MyFreeCamsClient client;
private MyFreeCamsHttpClient httpClient; private MyFreeCamsHttpClient httpClient;
@Override @Override
public void init() throws IOException { public void init() throws IOException {
baseUrl = Config.getInstance().getSettings().mfcBaseUrl;
client = MyFreeCamsClient.getInstance(); client = MyFreeCamsClient.getInstance();
client.setSite(this); client.setSite(this);
client.start(); client.start();
@ -41,12 +42,12 @@ public class MyFreeCams extends AbstractSite {
@Override @Override
public String getBaseUrl() { public String getBaseUrl() {
return BASE_URI; return baseUrl;
} }
@Override @Override
public String getAffiliateLink() { public String getAffiliateLink() {
return BASE_URI + "/?baf=8127165"; return baseUrl + "/?baf=8127165";
} }
@Override @Override
@ -59,7 +60,7 @@ public class MyFreeCams extends AbstractSite {
@Override @Override
public Integer getTokenBalance() throws IOException { public Integer getTokenBalance() throws IOException {
Request req = new Request.Builder().url(BASE_URI + "/php/account.php?request=status").build(); Request req = new Request.Builder().url(baseUrl + "/php/account.php?request=status").build();
try(Response response = getHttpClient().execute(req)) { try(Response response = getHttpClient().execute(req)) {
if(response.isSuccessful()) { if(response.isSuccessful()) {
String content = response.body().string(); String content = response.body().string();
@ -74,7 +75,7 @@ public class MyFreeCams extends AbstractSite {
@Override @Override
public String getBuyTokensLink() { public String getBuyTokensLink() {
return BASE_URI + "/php/purchase.php?request=tokens"; return baseUrl + "/php/purchase.php?request=tokens";
} }
@Override @Override

View File

@ -85,10 +85,11 @@ public class MyFreeCamsClient {
public void start() throws IOException { public void start() throws IOException {
running = true; running = true;
serverConfig = new ServerConfig(mfc.getHttpClient()); serverConfig = new ServerConfig(mfc);
List<String> websocketServers = new ArrayList<String>(serverConfig.wsServers.keySet()); List<String> websocketServers = new ArrayList<String>(serverConfig.wsServers.keySet());
String server = websocketServers.get((int) (Math.random()*websocketServers.size())); String server = websocketServers.get((int) (Math.random()*websocketServers.size()));
String wsUrl = "ws://" + server + ".myfreecams.com:8080/fcsl"; String wsUrl = "ws://" + server + ".myfreecams.com:8080/fcsl";
LOG.debug("Connecting to random websocket server {}", wsUrl);
Thread watchDog = new Thread(() -> { Thread watchDog = new Thread(() -> {
while(running) { while(running) {

View File

@ -53,8 +53,8 @@ public class MyFreeCamsHttpClient extends HttpClient {
.add("submit_login", "97") .add("submit_login", "97")
.build(); .build();
Request req = new Request.Builder() Request req = new Request.Builder()
.url(MyFreeCams.BASE_URI + "/php/login.php") .url(MyFreeCams.baseUrl + "/php/login.php")
.header("Referer", MyFreeCams.BASE_URI) .header("Referer", MyFreeCams.baseUrl)
.header("Content-Type", "application/x-www-form-urlencoded") .header("Content-Type", "application/x-www-form-urlencoded")
.post(body) .post(body)
.build(); .build();
@ -75,7 +75,7 @@ public class MyFreeCamsHttpClient extends HttpClient {
} }
private boolean checkLogin() throws IOException { private boolean checkLogin() throws IOException {
Request req = new Request.Builder().url(MyFreeCams.BASE_URI + "/php/account.php?request=status").build(); Request req = new Request.Builder().url(MyFreeCams.baseUrl + "/php/account.php?request=status").build();
try(Response response = execute(req)) { try(Response response = execute(req)) {
if(response.isSuccessful()) { if(response.isSuccessful()) {
String content = response.body().string(); String content = response.body().string();
@ -99,7 +99,7 @@ public class MyFreeCamsHttpClient extends HttpClient {
public Cookie getCookie(String name) { public Cookie getCookie(String name) {
CookieJar jar = client.cookieJar(); CookieJar jar = client.cookieJar();
HttpUrl url = HttpUrl.parse(MyFreeCams.BASE_URI); HttpUrl url = HttpUrl.parse(MyFreeCams.baseUrl);
List<Cookie> cookies = jar.loadForRequest(url); List<Cookie> cookies = jar.loadForRequest(url);
for (Cookie cookie : cookies) { for (Cookie cookie : cookies) {
if(Objects.equals(cookie.name(), name)) { if(Objects.equals(cookie.name(), name)) {

View File

@ -132,7 +132,7 @@ public class MyFreeCamsModel extends AbstractModel {
@Override @Override
public void receiveTip(int tokens) throws IOException { public void receiveTip(int tokens) throws IOException {
String tipUrl = MyFreeCams.BASE_URI + "/php/tip.php"; String tipUrl = MyFreeCams.baseUrl + "/php/tip.php";
String initUrl = tipUrl + "?request=tip&username="+getName()+"&broadcaster_id="+getUid(); String initUrl = tipUrl + "?request=tip&username="+getName()+"&broadcaster_id="+getUid();
Request req = new Request.Builder().url(initUrl).build(); Request req = new Request.Builder().url(initUrl).build();
try(Response resp = site.getHttpClient().execute(req)) { try(Response resp = site.getHttpClient().execute(req)) {

View File

@ -9,13 +9,16 @@ import java.util.Objects;
import org.json.JSONArray; import org.json.JSONArray;
import org.json.JSONObject; import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ctbrec.io.HttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
public class ServerConfig { public class ServerConfig {
private static final transient Logger LOG = LoggerFactory.getLogger(ServerConfig.class);
List<String> ajaxServers; List<String> ajaxServers;
List<String> videoServers; List<String> videoServers;
List<String> chatServers; List<String> chatServers;
@ -24,9 +27,11 @@ public class ServerConfig {
Map<String, String> wzobsServers; Map<String, String> wzobsServers;
Map<String, String> ngVideoServers; Map<String, String> ngVideoServers;
public ServerConfig(HttpClient client) throws IOException { public ServerConfig(MyFreeCams mfc) throws IOException {
Request req = new Request.Builder().url("http://www.myfreecams.com/_js/serverconfig.js").build(); String url = mfc.getBaseUrl() + "/_js/serverconfig.js";
Response resp = client.execute(req); LOG.debug("Loading server config from {}", url);
Request req = new Request.Builder().url(url).build();
Response resp = mfc.getHttpClient().execute(req);
String json = resp.body().string(); String json = resp.body().string();
JSONObject serverConfig = new JSONObject(json); JSONObject serverConfig = new JSONObject(json);

View File

@ -6,7 +6,7 @@
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<packaging>pom</packaging> <packaging>pom</packaging>
<version>1.12.1</version> <version>1.13.0</version>
<modules> <modules>
<module>../common</module> <module>../common</module>
@ -68,7 +68,7 @@
<dependency> <dependency>
<groupId>com.iheartradio.m3u8</groupId> <groupId>com.iheartradio.m3u8</groupId>
<artifactId>open-m3u8</artifactId> <artifactId>open-m3u8</artifactId>
<version>0.2.4</version> <version>0.2.7-CTBREC</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jcodec</groupId> <groupId>org.jcodec</groupId>

View File

@ -8,7 +8,7 @@
<parent> <parent>
<groupId>ctbrec</groupId> <groupId>ctbrec</groupId>
<artifactId>master</artifactId> <artifactId>master</artifactId>
<version>1.12.1</version> <version>1.13.0</version>
<relativePath>../master</relativePath> <relativePath>../master</relativePath>
</parent> </parent>