Skip to content
This repository has been archived by the owner on Apr 14, 2022. It is now read-only.

Commit

Permalink
Temp Fix problem
Browse files Browse the repository at this point in the history
  • Loading branch information
a1aw committed Mar 31, 2018
1 parent 9affa5c commit b9bd7e5
Show file tree
Hide file tree
Showing 11 changed files with 280 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The easiest,express osu! beatmap downloader helper!
Put a star if you like this software! I would be happy to continue developing this software!

## :warning: Legacy Old-site Parsing

Any v2 builds older than ```2.0.0-snapshot-b4``` will not work because of the deprecating of osu!-web old-site. All end users must update to ```2.0.0-snapshot-b4``` to temporarily fix the problem.

## v2 has released

Experimental Builds of osumer v2 has been released at https://github.com/mob41/osumer/releases/latest . And to all osumer clients with updater functionality. Please do not hesitate trying it with new features!
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/github/mob41/osumer/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ public class Config {
private static final String KEY_SELECTED_TONE_AFTER_DOWNLOAD = "toneAfterDownloadPath";

private static final String KEY_SELECTED_TONE_AFTER_DOWNLOAD_DEFAULT_VALUE = "C:\\Windows\\Media\\Windows Background.wav";

private static final String KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING = "legacy_enable_oldsite_beatmap_redirecting";

private static final boolean KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING_DEFAULT_VALUE = true;

private static final String KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION = "legacy_disable_oldsite_beatmap_redirecting_startup_notification";

private static final boolean KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION_DEFAULT_VALUE = false;

private JSONObject json;

Expand Down Expand Up @@ -447,6 +455,22 @@ public void setToneAfterDownloadPath(String path) {
public boolean isEnableToneAfterDownload(){
return json.getBoolean(KEY_ENABLE_TONE_AFTER_DOWNLOAD);
}

public void setLegacyEnableOldSiteBeatmapRedirecting(boolean enabled){
json.put(KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING, enabled);
}

public boolean isLegacyEnableOldSiteBeatmapRedirecting() {
return json.getBoolean(KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING);
}

public void setLegacyDisableOldSiteBeatmapRedirectingStartupNotification(boolean enabled){
json.put(KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION, enabled);
}

public boolean isLegacyDisableOldSiteBeatmapRedirectingStartupNotification() {
return json.getBoolean(KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION);
}

private static boolean fillJson(JSONObject json) {
boolean modified = false;
Expand Down Expand Up @@ -485,6 +509,8 @@ private static boolean fillJson(JSONObject json) {
modified |= ifNullPutValue(json, KEY_ENABLE_TONE_AFTER_DOWNLOAD, KEY_ENABLE_TONE_AFTER_DOWNLOAD_DEFAULT_VALUE);
modified |= ifNullPutValue(json, KEY_SELECTED_TONE_AFTER_DOWNLOAD,
KEY_SELECTED_TONE_AFTER_DOWNLOAD_DEFAULT_VALUE);
modified |= ifNullPutValue(json, KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING, KEY_LEGACY_ENABLE_OLDSITE_BEATMAP_REDIRECTING_DEFAULT_VALUE);
modified |= ifNullPutValue(json, KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION, KEY_LEGACY_DISABLE_OLDSITE_BEATMAP_REDIRECTING_STARTUP_NOTIFICATION_DEFAULT_VALUE);
return modified;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/github/mob41/osumer/Osumer.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class Osumer {

public static final String OSUMER_BRANCH = "snapshot";

public static final int OSUMER_BUILD_NUM = 3;
public static final int OSUMER_BUILD_NUM = 4;

private Osumer() {

Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/github/mob41/osumer/sock/ConnThread.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public void run() {
sockThread.getFrame().setAlwaysOnTop(false);
writer.println("OK");
} else if (line.startsWith("RUN")) {
System.gc();
sockThread.getFrame().checkUpdate();

String[] args = line.substring(4).split(" ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ public void run(){
}

if (osums.isLoggedIn()) {
maps = osums.getLinksOfBeatmapSearch(dialog.getHandler(), "https://osu.ppy.sh/p/beatmaplist?q=" + searchFld.getText());
//TODO: Change to use NEW Parser
maps = osums.getLinksOfBeatmapSearch(dialog.getHandler(), "https://old.ppy.sh/p/beatmaplist?q=" + searchFld.getText());
} else {
dialog.dispose();
JOptionPane.showMessageDialog(BeatmapSearchPanel.this, "You must be logged into osu! forum to perform online search.", "Error", JOptionPane.ERROR_MESSAGE);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
package com.github.mob41.osumer.ui;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.SwingConstants;
import java.awt.Color;
import javax.swing.LayoutStyle.ComponentPlacement;
import javax.swing.JTextPane;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import java.awt.SystemColor;
import javax.swing.ImageIcon;
import javax.swing.border.BevelBorder;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EtchedBorder;
import javax.swing.border.SoftBevelBorder;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class Legacy_OldSiteParsingDialog extends JDialog {

private final JPanel contentPanel = new JPanel();

/**
* Create the dialog.
*/
public Legacy_OldSiteParsingDialog() {
setTitle("osumer Legacy Mode Warning");
setBounds(100, 100, 616, 538);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
JLabel lblWarning = new JLabel("- Warning -");
lblWarning.setForeground(Color.RED);
lblWarning.setHorizontalAlignment(SwingConstants.CENTER);
lblWarning.setFont(new Font("Tahoma", Font.BOLD, 16));

JScrollPane scrollPane = new JScrollPane();

JLabel lblPleaseFollowThe = new JLabel("Please follow the following steps to enable legacy old-site support on your osumer.");
lblPleaseFollowThe.setHorizontalAlignment(SwingConstants.CENTER);

JLabel lblOpenpreferences = new JLabel("1. Open \"Preferences\" and go to \"(*) Legacy Old-site Beatmap\"");

JPanel panel = new JPanel();
panel.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));

JLabel lblTickenable = new JLabel("2. Tick \"Enable redirect to old-site automatically\"");

JPanel panel_1 = new JPanel();
panel_1.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));

JLabel lblYouCan = new JLabel("3. You can disable this message to show in startup by ticking the following.");

JPanel panel_2 = new JPanel();
panel_2.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null));
GroupLayout gl_contentPanel = new GroupLayout(contentPanel);
gl_contentPanel.setHorizontalGroup(
gl_contentPanel.createParallelGroup(Alignment.TRAILING)
.addGroup(Alignment.LEADING, gl_contentPanel.createSequentialGroup()
.addContainerGap()
.addGroup(gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addComponent(scrollPane, Alignment.TRAILING)
.addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
.addComponent(lblWarning, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
.addComponent(lblPleaseFollowThe, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
.addComponent(lblOpenpreferences)
.addComponent(panel, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
.addComponent(lblTickenable, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE)
.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, 558, Short.MAX_VALUE)
.addComponent(lblYouCan, GroupLayout.DEFAULT_SIZE, 558, Short.MAX_VALUE))
.addContainerGap())
);
gl_contentPanel.setVerticalGroup(
gl_contentPanel.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPanel.createSequentialGroup()
.addContainerGap()
.addComponent(lblWarning)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(scrollPane, GroupLayout.PREFERRED_SIZE, 124, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblPleaseFollowThe)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblOpenpreferences)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(panel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblTickenable)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblYouCan)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(panel_2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
.addContainerGap(37, Short.MAX_VALUE))
);

JLabel lblImg3 = new JLabel("");
lblImg3.setIcon(new ImageIcon(Legacy_OldSiteParsingDialog.class.getResource("/com/github/mob41/osumer/ui/legacyoldsite_3.PNG")));
lblImg3.setHorizontalAlignment(SwingConstants.CENTER);
panel_2.add(lblImg3);

JLabel lblImg2 = new JLabel("");
lblImg2.setHorizontalAlignment(SwingConstants.CENTER);
lblImg2.setIcon(new ImageIcon(Legacy_OldSiteParsingDialog.class.getResource("/com/github/mob41/osumer/ui/legacyoldsite_2.PNG")));
panel_1.add(lblImg2);

JLabel lblImg1 = new JLabel("");
lblImg1.setHorizontalAlignment(SwingConstants.CENTER);
lblImg1.setIcon(new ImageIcon(Legacy_OldSiteParsingDialog.class.getResource("/com/github/mob41/osumer/ui/legacyoldsite_1.PNG")));
panel.add(lblImg1);

JTextArea txtrAsTheOsu = new JTextArea();
txtrAsTheOsu.setFont(new Font("Tahoma", Font.BOLD, 14));
txtrAsTheOsu.setLineWrap(true);
txtrAsTheOsu.setText("As the osu! new-site is going to be used, the existing old-site parser in osumer WILL NOT WORK since 2.0.0-snapshot-b3 and leading the application to stop working. This is an emergency update to redirect beatmaps back to old-site URLs.\r\n\r\nYou will see this message if legacy old-site is disabled\r\nThis message will show in every startup. You can disable this in Preferences.");
txtrAsTheOsu.setBackground(SystemColor.control);
txtrAsTheOsu.setEditable(false);
scrollPane.setViewportView(txtrAsTheOsu);
contentPanel.setLayout(gl_contentPanel);
{
JPanel buttonPane = new JPanel();
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
getContentPane().add(buttonPane, BorderLayout.SOUTH);
{
JButton okButton = new JButton("OK");
okButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
dispose();
}
});
okButton.setActionCommand("OK");
buttonPane.add(okButton);
getRootPane().setDefaultButton(okButton);
}
}
}
}
66 changes: 66 additions & 0 deletions src/main/java/com/github/mob41/osumer/ui/PreferenceDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ public class PreferenceDialog extends JDialog {
private JLabel lblFileToneAfter;
private JButton btnSelectToneBefore;
private JButton btnSelectToneAfter;
private JCheckBox chckbxEnableRedirectTo;
private JCheckBox chckbxDisableStartupNotification;

/**
* Create the dialog.
Expand Down Expand Up @@ -1419,6 +1421,62 @@ public void actionPerformed(ActionEvent e) {
);
soundTonePanel.setLayout(gl_soundTonePanel);
miscPanel.setLayout(gl_miscPanel);

JPanel panel_6 = new JPanel();
tab.addTab("(*) Legacy Old-site Beatmap", null, panel_6, null);

JLabel lblThisIsAn = new JLabel("This is an emergency update for legacy reading and downloading old-site beatmap urls.");

JLabel lblTheNewsiteWebpage = new JLabel("The new-site web-page parser is not implemented in this version.");

chckbxEnableRedirectTo = new JCheckBox("Enable redirect to old-site automatically (Legacy)");
chckbxEnableRedirectTo.setFont(new Font("Tahoma", Font.PLAIN, 14));
chckbxEnableRedirectTo.setHorizontalAlignment(SwingConstants.CENTER);

JLabel lblPleaseEnableThe = new JLabel("Please enable the following option to temporarily fix the problem.");
lblPleaseEnableThe.setFont(new Font("Tahoma", Font.BOLD, 14));
lblPleaseEnableThe.setHorizontalAlignment(SwingConstants.CENTER);

chckbxDisableStartupNotification = new JCheckBox("Disable startup notification, warning");

JLabel lblThisOptionWill = new JLabel("This option will be automatically DISABLED when the parser is implemented in next version.");
lblThisOptionWill.setHorizontalAlignment(SwingConstants.CENTER);
GroupLayout gl_panel_6 = new GroupLayout(panel_6);
gl_panel_6.setHorizontalGroup(
gl_panel_6.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_6.createSequentialGroup()
.addContainerGap()
.addGroup(gl_panel_6.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_6.createSequentialGroup()
.addGroup(gl_panel_6.createParallelGroup(Alignment.TRAILING)
.addComponent(lblThisOptionWill, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
.addComponent(lblTheNewsiteWebpage, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
.addComponent(lblThisIsAn, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
.addComponent(lblPleaseEnableThe, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE)
.addComponent(chckbxEnableRedirectTo, Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 760, Short.MAX_VALUE))
.addContainerGap())
.addGroup(gl_panel_6.createSequentialGroup()
.addComponent(chckbxDisableStartupNotification, GroupLayout.DEFAULT_SIZE, 756, Short.MAX_VALUE)
.addGap(18))))
);
gl_panel_6.setVerticalGroup(
gl_panel_6.createParallelGroup(Alignment.LEADING)
.addGroup(gl_panel_6.createSequentialGroup()
.addContainerGap()
.addComponent(lblThisIsAn)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblTheNewsiteWebpage)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblPleaseEnableThe)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(chckbxEnableRedirectTo)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(lblThisOptionWill)
.addPreferredGap(ComponentPlacement.RELATED)
.addComponent(chckbxDisableStartupNotification)
.addContainerGap(299, Short.MAX_VALUE))
);
panel_6.setLayout(gl_panel_6);
}
{
JPanel buttonPane = new JPanel();
Expand Down Expand Up @@ -1681,6 +1739,10 @@ public int compare(String arg0, String arg1) {
toneBeforeField.setText(config.getToneBeforeDownloadPath());
chckbxToneAfterDwn.setSelected(config.isEnableToneAfterDownload());
toneAfterField.setText(config.getToneAfterDownloadPath());

//(*) Legacy Old-site Beatmap
chckbxEnableRedirectTo.setSelected(config.isLegacyEnableOldSiteBeatmapRedirecting());
chckbxDisableStartupNotification.setSelected(config.isLegacyDisableOldSiteBeatmapRedirectingStartupNotification());
}

private void applyChanges(){
Expand Down Expand Up @@ -1770,6 +1832,10 @@ private void applyChanges(){
config.setEnableToneAfterDownload(chckbxToneAfterDwn.isSelected());
config.setToneAfterDownloadPath(toneAfterField.getText());

//(*) Legacy Old-site Beatmap
config.setLegacyEnableOldSiteBeatmapRedirecting(chckbxEnableRedirectTo.isSelected());
config.setLegacyDisableOldSiteBeatmapRedirectingStartupNotification(chckbxDisableStartupNotification.isSelected());

try {
config.write();
} catch (IOException e) {
Expand Down
Loading

0 comments on commit b9bd7e5

Please sign in to comment.