forked from j62/ctbrec
1
0
Fork 0

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 possibility to add models by their URL
* 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
* Fix: Don't throw exceptions for unknown attributes in PlaylistParser
* Fix: Don't do space check, if minimum is set to 0
* Fix: Player not starting when path contains spaces
1.12.1
========================

View File

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

View File

@ -26,6 +26,7 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
GridPane layout = SettingsTab.createGridLayout();
layout.add(new Label("MyFreeCams User"), 0, 0);
TextField username = new TextField(Config.getInstance().getSettings().mfcUsername);
username.setPrefWidth(300);
username.textProperty().addListener((ob, o, n) -> {
Config.getInstance().getSettings().mfcUsername = username.getText();
save();
@ -47,13 +48,27 @@ public class MyFreeCamsConfigUI extends AbstractConfigUI {
GridPane.setColumnSpan(password, 2);
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");
createAccount.setOnAction((e) -> DesktopIntegration.open(myFreeCams.getAffiliateLink()));
layout.add(createAccount, 1, 2);
layout.add(createAccount, 1, 3);
GridPane.setColumnSpan(createAccount, 2);
GridPane.setMargin(username, 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));
return layout;
}
}

View File

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

View File

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

View File

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

View File

@ -17,13 +17,14 @@ import okhttp3.Response;
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 MyFreeCamsHttpClient httpClient;
@Override
public void init() throws IOException {
baseUrl = Config.getInstance().getSettings().mfcBaseUrl;
client = MyFreeCamsClient.getInstance();
client.setSite(this);
client.start();
@ -41,12 +42,12 @@ public class MyFreeCams extends AbstractSite {
@Override
public String getBaseUrl() {
return BASE_URI;
return baseUrl;
}
@Override
public String getAffiliateLink() {
return BASE_URI + "/?baf=8127165";
return baseUrl + "/?baf=8127165";
}
@Override
@ -59,7 +60,7 @@ public class MyFreeCams extends AbstractSite {
@Override
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)) {
if(response.isSuccessful()) {
String content = response.body().string();
@ -74,7 +75,7 @@ public class MyFreeCams extends AbstractSite {
@Override
public String getBuyTokensLink() {
return BASE_URI + "/php/purchase.php?request=tokens";
return baseUrl + "/php/purchase.php?request=tokens";
}
@Override

View File

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

View File

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

View File

@ -132,7 +132,7 @@ public class MyFreeCamsModel extends AbstractModel {
@Override
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();
Request req = new Request.Builder().url(initUrl).build();
try(Response resp = site.getHttpClient().execute(req)) {

View File

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

View File

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

View File

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