LazyHostPlugin:

-added getDomainInfo
DomainInfo:
-getInstance now keeps the subdomain
Account:
-added getDomainInfo


git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49851 ebf7c1c2-ba36-0410-9fe8-c592906822b4

Former-commit-id: 814e5fc8334d6d76d6e7e290222fc55a1f7364fd
This commit is contained in:
jiaz 2024-09-24 14:41:12 +00:00
parent 6fe467242e
commit f56ac4cb2f
22 changed files with 178 additions and 222 deletions

View File

@ -6,12 +6,6 @@ import java.util.Iterator;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import org.appwork.utils.DebugMode;
import org.appwork.utils.StringUtils;
import org.jdownloader.DomainInfo;
import org.jdownloader.controlling.hosterrule.AccountGroup.Rules;
import org.jdownloader.controlling.hosterrule.CachedAccountGroup;
import jd.controlling.downloadcontroller.AccountCache.CachedAccount;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
@ -20,6 +14,12 @@ import jd.plugins.MultiHostHost;
import jd.plugins.MultiHostHost.MultihosterHostStatus;
import jd.plugins.PluginForHost;
import org.appwork.utils.DebugMode;
import org.appwork.utils.StringUtils;
import org.jdownloader.DomainInfo;
import org.jdownloader.controlling.hosterrule.AccountGroup.Rules;
import org.jdownloader.controlling.hosterrule.CachedAccountGroup;
public class AccountCache implements Iterable<CachedAccount> {
public static enum ACCOUNTTYPE {
/* DO NOT CHANGE ORDER HERE, we use compareTo which uses ordinal */
@ -56,7 +56,7 @@ public class AccountCache implements Iterable<CachedAccount> {
}
this.plugin = plugin;
this.host = host;
pluginDomainInfo = plugin != null ? DomainInfo.getInstance(plugin.getHost(), true) : null;
pluginDomainInfo = plugin != null ? DomainInfo.getInstance(plugin.getHost()) : null;
}
public final Account getAccount() {
@ -181,25 +181,25 @@ public class AccountCache implements Iterable<CachedAccount> {
}
protected final static AccountCache NA = new AccountCache(null) {
public java.util.Iterator<CachedAccount> iterator() {
return new Iterator<AccountCache.CachedAccount>() {
@Override
public boolean hasNext() {
return false;
}
public java.util.Iterator<CachedAccount> iterator() {
return new Iterator<AccountCache.CachedAccount>() {
@Override
public boolean hasNext() {
return false;
}
@Override
public CachedAccount next() {
return null;
}
@Override
public CachedAccount next() {
return null;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
};
};
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
};
};
protected final List<CachedAccountGroup> cache;
public boolean isCustomizedCache() {

View File

@ -10,6 +10,7 @@ import jd.controlling.linkcollector.LinknameCleaner;
import jd.controlling.packagecontroller.AbstractNode;
import jd.controlling.packagecontroller.AbstractNodeNotifier;
import jd.controlling.packagecontroller.AbstractPackageChildrenNode;
import jd.http.Browser;
import jd.plugins.Account;
import jd.plugins.CryptedLink;
import jd.plugins.DownloadLink;
@ -619,9 +620,8 @@ public class CrawledLink implements AbstractPackageChildrenNode<CrawledPackage>,
final DownloadLink dlLink = getDownloadLink();
if (dlLink != null) {
return dlLink.getDomainInfo();
} else {
return null;
}
return DomainInfo.getInstance(Browser.getHost(getURL(), true));
}
public CrawledLinkModifier getCustomCrawledLinkModifier() {

View File

@ -8,15 +8,15 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.regex.Pattern;
import jd.http.Browser;
import jd.http.Cookie;
import jd.http.Cookies;
import org.appwork.utils.StringUtils;
import org.appwork.utils.logging2.LogInterface;
import org.appwork.utils.net.URLHelper;
import org.jdownloader.controlling.UniqueAlltimeID;
import jd.http.Browser;
import jd.http.Cookie;
import jd.http.Cookies;
public class LinkCrawlerRule {
public static enum RULE {
REWRITE,
@ -27,7 +27,7 @@ public class LinkCrawlerRule {
}
protected boolean enabled = true;
protected Object cookies = null;
protected List<String[]> cookies = null;
protected List<String[]> headers = null;
protected Map<String, List<Pattern>> propertyPatterns = null;
protected boolean updateCookies = false;
@ -49,13 +49,6 @@ public class LinkCrawlerRule {
this.updateCookies = updateCookies;
}
public List<String[]> getCookiesList() {
if (!(this.cookies instanceof List)) {
return null;
}
return (List<String[]>) this.cookies;
}
public Object getCookies() {
return cookies;
}
@ -63,7 +56,7 @@ public class LinkCrawlerRule {
public void setCookies(final Object obj) {
final Cookies cookies = Cookies.parseCookiesFromObject(obj, null);
if (cookies == null) {
setCookiesList(null);
_setCookies(null);
return;
}
final List<String[]> cookielist = new ArrayList<String[]>();
@ -76,11 +69,7 @@ public class LinkCrawlerRule {
cookielist.add(cookiearray);
}
}
setCookiesList(cookielist);
}
public void setCookiesList(final List<String[]> cookies) {
this.cookies = cookies;
_setCookies(cookielist);
}
public List<String[]> getHeaders() {
@ -199,13 +188,21 @@ public class LinkCrawlerRule {
updateCookies.add(new String[] { cookie.getKey(), cookie.getValue() });
}
}
setCookiesList(updateCookies);
_setCookies(updateCookies);
// TODO: add support for length==3, url pattern matching support
return true;
}
return false;
}
private void _setCookies(List<String[]> cookies) {
if (cookies == null || cookies.size() == 0) {
this.cookies = null;
} else {
this.cookies = cookies;
}
}
public void applyCookiesAndHeaders(final Browser br, final String url, final boolean onlyOnPatternMatch) {
applyCookies(br, url, onlyOnPatternMatch);
applyHeaders(br);
@ -216,7 +213,7 @@ public class LinkCrawlerRule {
if (onlyOnPatternMatch && !matches(url)) {
return false;
}
final List<String[]> cookies = getCookiesList();
final List<String[]> cookies = this.cookies;
if (cookies == null || cookies.size() == 0) {
return false;
}

View File

@ -21,6 +21,11 @@ import javax.swing.ListSelectionModel;
import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import jd.gui.swing.jdgui.views.settings.panels.accountmanager.AccountEntry;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import net.miginfocom.swing.MigLayout;
import org.appwork.swing.components.tooltips.PanelToolTip;
import org.appwork.swing.components.tooltips.TooltipPanel;
import org.appwork.utils.swing.SwingUtils;
@ -31,11 +36,6 @@ import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import org.jdownloader.updatev2.gui.LAFOptions;
import jd.gui.swing.jdgui.views.settings.panels.accountmanager.AccountEntry;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import net.miginfocom.swing.MigLayout;
public class AccountTooltip extends PanelToolTip {
private Color color;
private AccountListTable table;
@ -157,7 +157,7 @@ public class AccountTooltip extends PanelToolTip {
if (plg == null) {
continue;
}
domains.add(DomainInfo.getInstance(plg.getHost(), true));
domains.add(plg.getDomainInfo());
}
}
final ArrayList<DomainInfo> ret = new ArrayList<DomainInfo>(domains);

View File

@ -33,6 +33,19 @@ import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.SwingUtilities;
import jd.SecondLevelLaunch;
import jd.controlling.AccountController;
import jd.controlling.AccountControllerEvent;
import jd.controlling.AccountControllerListener;
import jd.gui.swing.dialog.AddAccountDialog;
import jd.gui.swing.jdgui.JDGui;
import jd.gui.swing.jdgui.views.settings.ConfigurationView;
import jd.gui.swing.jdgui.views.settings.panels.accountmanager.AccountManagerSettings;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import jd.plugins.PluginForHost;
import net.miginfocom.swing.MigLayout;
import org.appwork.scheduler.DelayedRunnable;
import org.appwork.storage.config.JsonConfig;
import org.appwork.storage.config.ValidationException;
@ -55,19 +68,6 @@ import org.jdownloader.settings.GraphicalUserInterfaceSettings;
import org.jdownloader.settings.GraphicalUserInterfaceSettings.PremiumStatusBarDisplay;
import org.jdownloader.settings.staticreferences.CFG_GUI;
import jd.SecondLevelLaunch;
import jd.controlling.AccountController;
import jd.controlling.AccountControllerEvent;
import jd.controlling.AccountControllerListener;
import jd.gui.swing.dialog.AddAccountDialog;
import jd.gui.swing.jdgui.JDGui;
import jd.gui.swing.jdgui.views.settings.ConfigurationView;
import jd.gui.swing.jdgui.views.settings.panels.accountmanager.AccountManagerSettings;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import jd.plugins.PluginForHost;
import net.miginfocom.swing.MigLayout;
public class ServicePanel extends JPanel implements MouseListener, AccountTooltipOwner {
private static final long serialVersionUID = 7290466989514173719L;
private DelayedRunnable redrawTimer;
@ -78,7 +78,7 @@ public class ServicePanel extends JPanel implements MouseListener, AccountToolti
throw new HeadlessException();
}
}
private AtomicBoolean redrawing = new AtomicBoolean(false);
private AtomicBoolean redrawing = new AtomicBoolean(false);
public static ServicePanel getInstance() {
return INSTANCE;
@ -278,7 +278,7 @@ public class ServicePanel extends JPanel implements MouseListener, AccountToolti
}
final PluginForHost plugin = acc.getPlugin();
if (plugin != null) {
final DomainInfo domainInfo = DomainInfo.getInstance(plugin.getHost(), true);
final DomainInfo domainInfo = DomainInfo.getInstance(plugin.getHost());
final String domainTld = domainInfo.getTld();
domainInfo.getFavIcon();
switch (premiumStatusBarDisplay) {

View File

@ -23,26 +23,25 @@ import java.awt.event.WindowFocusListener;
import javax.swing.JComponent;
import javax.swing.JPanel;
import org.appwork.utils.event.queue.QueueAction;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.jdownloader.DomainInfo;
import org.jdownloader.gui.InputChangedCallbackInterface;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.plugins.accounts.AccountBuilderInterface;
import jd.controlling.TaskQueue;
import jd.controlling.accountchecker.AccountChecker;
import jd.gui.swing.dialog.InputOKButtonAdapter;
import jd.plugins.Account;
import net.miginfocom.swing.MigLayout;
import org.appwork.utils.event.queue.QueueAction;
import org.appwork.utils.swing.dialog.AbstractDialog;
import org.jdownloader.gui.InputChangedCallbackInterface;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.plugins.accounts.AccountBuilderInterface;
public class EditAccountDialog extends AbstractDialog<Integer> implements InputChangedCallbackInterface {
private final Account acc;
private AccountBuilderInterface accountBuilderUI;
private JPanel content;
public EditAccountDialog(Account acc) {
super(0, _GUI.T.jd_gui_swing_components_AccountDialog_edit_title(), DomainInfo.getInstance(acc.getHosterByPlugin()).getFavIcon(), _GUI.T.lit_save(), null);
super(0, _GUI.T.jd_gui_swing_components_AccountDialog_edit_title(), acc.getDomainInfo().getFavIcon(), _GUI.T.lit_save(), null);
this.acc = acc;
}

View File

@ -8,6 +8,10 @@ import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import jd.controlling.AccountController;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
@ -20,10 +24,6 @@ import org.jdownloader.plugins.controller.LazyPlugin.FEATURE;
import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import jd.controlling.AccountController;
import jd.plugins.Account;
import jd.plugins.AccountInfo;
public class NewRuleAction extends AbstractAddAction {
/**
*
@ -87,7 +87,7 @@ public class NewRuleAction extends AbstractAddAction {
}
final LazyHostPlugin plg = HostPluginController.getInstance().get(supportedHost);
if (plg != null) {
domains.add(DomainInfo.getInstance(plg.getHost(), true));
domains.add(plg.getDomainInfo());
}
}
}
@ -95,7 +95,7 @@ public class NewRuleAction extends AbstractAddAction {
/* Collect all domains which the user is allowed to create usage rules for. */
for (final LazyHostPlugin plugin : plugins) {
if (allowAccountUsageRuleCreation(plugin)) {
domains.add(DomainInfo.getInstance(plugin.getHost(), true));
domains.add(plugin.getDomainInfo());
}
}
/* Sort results. */

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -193,10 +192,7 @@ public class ResultTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}
@ -205,10 +201,7 @@ public class ResultTableModel extends ExtTableModel<CrawledLink> {
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -193,10 +192,7 @@ public class SingleFilterResultTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}
@ -205,10 +201,7 @@ public class SingleFilterResultTableModel extends ExtTableModel<CrawledLink> {
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -179,10 +178,7 @@ public class ViewTestResultTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}
@ -191,10 +187,7 @@ public class ViewTestResultTableModel extends ExtTableModel<CrawledLink> {
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}

View File

@ -6,7 +6,6 @@ import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.gui.swing.jdgui.views.settings.panels.packagizer.PackagizerFilterRuleDialog.RuleMatcher;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -206,24 +205,18 @@ public class PackagizerSingleTestTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
if (domain == null) {
return null;
}
return null;
}
return domain.getFavIcon(false);
}
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
if (domain == null) {
return null;
}
return null;
}
return domain.getTld();
}

View File

@ -37,6 +37,7 @@ import org.appwork.storage.config.annotations.LabelInterface;
import org.appwork.utils.Hash;
import org.appwork.utils.StringUtils;
import org.appwork.utils.formatter.TimeFormatter;
import org.jdownloader.DomainInfo;
import org.jdownloader.controlling.UniqueAlltimeID;
import org.jdownloader.logging.LogController;
import org.jdownloader.settings.staticreferences.CFG_GENERAL;
@ -85,6 +86,17 @@ public class Account extends Property {
return null;
}
private DomainInfo domainInfo;
public DomainInfo getDomainInfo() {
DomainInfo domainInfo = this.domainInfo;
if (domainInfo == null) {
domainInfo = DomainInfo.getInstance(getHosterByPlugin(true));
this.domainInfo = domainInfo;
}
return domainInfo;
}
public final AccountTrafficView getAccountTrafficView() {
final PluginForHost plugin = getPlugin();
if (plugin == null) {
@ -377,9 +389,13 @@ public class Account extends Property {
}
public String getHosterByPlugin() {
return getHosterByPlugin(false);
}
public String getHosterByPlugin(final boolean includeSubdomain) {
final PluginForHost plugin = this.getPlugin();
if (plugin != null && isMultiPlugin()) {
final String ret = plugin.getHost(null, this, false);
final String ret = plugin.getHost(null, this, includeSubdomain);
if (ret != null) {
return ret;
}

View File

@ -310,9 +310,9 @@ public abstract class PluginConfigPanelNG extends AbstractConfigPanel implements
* synchronized on list because plugins can change the list in runtime
*/
for (String sup : supported) {
LazyHostPlugin plg = HostPluginController.getInstance().get(sup);
final LazyHostPlugin plg = HostPluginController.getInstance().get(sup);
if (plg != null) {
domains.add(DomainInfo.getInstance(plg.getHost()));
domains.add(plg.getDomainInfo());
}
}
}

View File

@ -25,6 +25,26 @@ import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import jd.PluginWrapper;
import jd.config.SubConfiguration;
import jd.controlling.ProgressController;
import jd.controlling.captcha.CaptchaSettings;
import jd.controlling.captcha.SkipException;
import jd.controlling.captcha.SkipRequest;
import jd.controlling.downloadcontroller.SingleDownloadController;
import jd.controlling.linkcollector.LinkCollector;
import jd.controlling.linkcollector.LinkCollector.JobLinkCrawler;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.LinkCrawler;
import jd.controlling.linkcrawler.LinkCrawler.LinkCrawlerGeneration;
import jd.controlling.linkcrawler.LinkCrawlerDistributer;
import jd.controlling.linkcrawler.LinkCrawlerThread;
import jd.http.Browser;
import jd.http.Browser.BlockedByException;
import jd.http.Browser.BrowserException;
import jd.nutils.encoding.Encoding;
import jd.plugins.DecrypterRetryException.RetryReason;
import org.appwork.storage.config.JsonConfig;
import org.appwork.timetracker.TimeTracker;
import org.appwork.timetracker.TrackerJob;
@ -38,7 +58,6 @@ import org.appwork.utils.Regex;
import org.appwork.utils.StringUtils;
import org.appwork.utils.logging2.LogInterface;
import org.appwork.utils.logging2.LogSource;
import org.jdownloader.DomainInfo;
import org.jdownloader.captcha.blacklist.BlacklistEntry;
import org.jdownloader.captcha.blacklist.BlockAllCrawlerCaptchasEntry;
import org.jdownloader.captcha.blacklist.BlockCrawlerCaptchasByHost;
@ -70,26 +89,6 @@ import org.jdownloader.plugins.controller.host.HostPluginController;
import org.jdownloader.plugins.controller.host.LazyHostPlugin;
import org.jdownloader.translate._JDT;
import jd.PluginWrapper;
import jd.config.SubConfiguration;
import jd.controlling.ProgressController;
import jd.controlling.captcha.CaptchaSettings;
import jd.controlling.captcha.SkipException;
import jd.controlling.captcha.SkipRequest;
import jd.controlling.downloadcontroller.SingleDownloadController;
import jd.controlling.linkcollector.LinkCollector;
import jd.controlling.linkcollector.LinkCollector.JobLinkCrawler;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.LinkCrawler;
import jd.controlling.linkcrawler.LinkCrawler.LinkCrawlerGeneration;
import jd.controlling.linkcrawler.LinkCrawlerDistributer;
import jd.controlling.linkcrawler.LinkCrawlerThread;
import jd.http.Browser;
import jd.http.Browser.BlockedByException;
import jd.http.Browser.BrowserException;
import jd.nutils.encoding.Encoding;
import jd.plugins.DecrypterRetryException.RetryReason;
/**
* Dies ist die Oberklasse für alle Plugins, die Links entschlüsseln können
*
@ -144,16 +143,16 @@ public abstract class PluginForDecrypt extends Plugin {
}
/**
* Use this when e.g. crawling folders & subfolders from cloud-services. </br>
* Use this to find the last path in order to continue to build the path until all subfolders are crawled.
* Use this when e.g. crawling folders & subfolders from cloud-services. </br> Use this to find the last path in order to continue to
* build the path until all subfolders are crawled.
*/
protected final String getAdoptedCloudFolderStructure() {
return getAdoptedCloudFolderStructure(null);
}
/**
* Use this when e.g. crawling folders & subfolders from cloud-services. </br>
* Use this to find the last path in order to continue to build the path until all subfolders are crawled.
* Use this when e.g. crawling folders & subfolders from cloud-services. </br> Use this to find the last path in order to continue to
* build the path until all subfolders are crawled.
*/
protected final String getAdoptedCloudFolderStructure(final String fallback) {
CrawledLink current = getCurrentLink();
@ -611,8 +610,7 @@ public abstract class PluginForDecrypt extends Plugin {
case RETRY:
throw new PluginException(LinkStatus.ERROR_RETRY);
case ASK:
final DomainInfo domainInfo = getDomainInfo(link);
if (UIOManager.I().showConfirmDialog(0, _GUI.T.gui_captchaWindow_askForInput(domainInfo.getTld()), _GUI.T.StatusBarImpl_skippedCrawlersMarker_desc(1), new AbstractIcon(IconKey.ICON_QUESTION, 32), _GUI.T.CaptchaDialog_layoutDialogContent_refresh(), _GUI.T.AbstractCaptchaDialog_AbstractCaptchaDialog_cancel())) {
if (UIOManager.I().showConfirmDialog(0, _GUI.T.gui_captchaWindow_askForInput(link.getDomainInfo().getTld()), _GUI.T.StatusBarImpl_skippedCrawlersMarker_desc(1), new AbstractIcon(IconKey.ICON_QUESTION, 32), _GUI.T.CaptchaDialog_layoutDialogContent_refresh(), _GUI.T.AbstractCaptchaDialog_AbstractCaptchaDialog_cancel())) {
throw new PluginException(LinkStatus.ERROR_RETRY);
}
break;
@ -625,18 +623,10 @@ public abstract class PluginForDecrypt extends Plugin {
}
}
protected DomainInfo getDomainInfo(final CrawledLink link) {
DomainInfo ret = link.getDomainInfo();
if (ret == null) {
ret = DomainInfo.getInstance(Browser.getHost(link.getURL()));
}
return ret;
}
@Override
protected void displayBubbleNotification(final String title, final String text) {
final CrawledLink link = getCurrentLink();
displayBubbleNotification(title, text, link != null ? getDomainInfo(link).getIcon(32) : null);
displayBubbleNotification(title, text, link != null ? link.getDomainInfo().getIcon(32) : null);
}
protected String getCaptchaCode(final Browser br, final String method, final String captchaAddress, final CryptedLink param) throws Exception {

View File

@ -9,13 +9,6 @@ import java.util.Locale;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import org.appwork.swing.components.IDIcon;
import org.appwork.swing.components.IconIdentifier;
import org.appwork.utils.images.IconIO;
import org.jdownloader.gui.IconKey;
import org.jdownloader.images.AbstractIcon;
import org.jdownloader.images.NewTheme;
import jd.config.Property;
import jd.controlling.faviconcontroller.FavIconRequestor;
import jd.controlling.faviconcontroller.FavIcons;
@ -23,6 +16,13 @@ import jd.http.Browser;
import jd.plugins.PluginForHost;
import jd.utils.JDUtilities;
import org.appwork.swing.components.IDIcon;
import org.appwork.swing.components.IconIdentifier;
import org.appwork.utils.images.IconIO;
import org.jdownloader.gui.IconKey;
import org.jdownloader.images.AbstractIcon;
import org.jdownloader.images.NewTheme;
public class DomainInfo implements FavIconRequestor, Comparable<DomainInfo>, Icon, IDIcon {
private static final HashMap<String, String> HARDCODEDFAVICONS = new HashMap<String, String>();
static {
@ -38,10 +38,10 @@ public class DomainInfo implements FavIconRequestor, Comparable<DomainInfo>, Ico
HARDCODEDFAVICONS.put("usenet", IconKey.ICON_LOGO_NZB);
HARDCODEDFAVICONS.put("genericusenet", IconKey.ICON_LOGO_NZB);
}
private static final int WIDTH = 16;
private static final int HEIGHT = 16;
private final String domain;
private final IconIdentifier iconIdentifier;
private static final int WIDTH = 16;
private static final int HEIGHT = 16;
private final String domain;
private final IconIdentifier iconIdentifier;
private DomainInfo(String tld, String domain) {
this.tld = Property.dedupeString(tld);
@ -151,12 +151,7 @@ public class DomainInfo implements FavIconRequestor, Comparable<DomainInfo>, Ico
return ret;
}
/** Returns DomainInfo without subdomain */
public static DomainInfo getInstance(final String domain) {
return getInstance(domain, false);
}
public static DomainInfo getInstance(final String domain, final boolean includeSubdomain) {
if (domain == null) {
return null;
}
@ -165,7 +160,7 @@ public class DomainInfo implements FavIconRequestor, Comparable<DomainInfo>, Ico
DomainInfo ret = null;
final WeakReference<DomainInfo> domainInfo = CACHE.get(lcaseTld);
if (domainInfo == null || (ret = domainInfo.get()) == null) {
ret = new DomainInfo(Browser.getHost(lcaseTld, includeSubdomain), lcaseTld);
ret = new DomainInfo(Browser.getHost(lcaseTld, true), lcaseTld);
CACHE.put(lcaseTld, new WeakReference<DomainInfo>(ret));
}
return ret;

View File

@ -10,7 +10,6 @@ import jd.plugins.DownloadLink;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.SwingUtils;
import org.jdownloader.DomainInfo;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.notify.AbstractBubbleContentPanel;
import org.jdownloader.gui.notify.gui.CFG_BUBBLE;
@ -47,7 +46,7 @@ public class DownloadStartedContentPanel extends AbstractBubbleContentPanel {
}
if (CFG_BUBBLE.DOWNLOAD_STARTED_BUBBLE_CONTENT_ACCOUNT_VISIBLE.isEnabled()) {
if (account != null) {
this.account = addPair(this.account, _GUI.T.lit_account() + ":", DomainInfo.getInstance(account.getHosterByPlugin()).getFavIcon());
this.account = addPair(this.account, _GUI.T.lit_account() + ":", account.getDomainInfo().getFavIcon());
this.account.setText(account.getUser() + (CFG_GUI.SHOW_FULL_HOSTNAME.isEnabled() ? "@" + account.getHoster() : ""));
}
}

View File

@ -80,9 +80,9 @@ import org.jdownloader.settings.staticreferences.CFG_GUI;
public class BannerRotation implements Sponsor, AccountControllerListener {
private final List<AvailableBanner> allBanners = new CopyOnWriteArrayList<AvailableBanner>();
private final Queue queue = new Queue("Banner") {
public void killQueue() {
};
};
public void killQueue() {
};
};
private class AvailableBanner implements DownloadControllerListener, LinkCollectorListener, DownloadWatchdogListener, AccountControllerListener {
private volatile boolean hasDownloadLinks = false;
@ -97,8 +97,8 @@ public class BannerRotation implements Sponsor, AccountControllerListener {
private long lastUpdateTimestamp = -1;
private final DomainInfo domainInfo;
protected AvailableBanner(final DomainInfo domainInfo) {
this.domainInfo = domainInfo;
protected AvailableBanner(final String domain) {
this.domainInfo = DomainInfo.getInstance(domain);
DownloadController.getInstance().getEventSender().addListener(this, true);
LinkCollector.getInstance().getEventsender().addListener(this, true);
DownloadWatchDog.getInstance().getEventSender().addListener(this, true);
@ -737,15 +737,15 @@ public class BannerRotation implements Sponsor, AccountControllerListener {
}
});
isBannerEnabled.set(CFG_GUI.BANNER_ENABLED.isEnabled());
getAllBanners().add(new AvailableBanner(DomainInfo.getInstance("rapidgator.net")));
getAllBanners().add(new AvailableBanner(DomainInfo.getInstance("k2s.cc")) {
getAllBanners().add(new AvailableBanner("rapidgator.net"));
getAllBanners().add(new AvailableBanner("k2s.cc") {
@Override
protected String getIconHost() {
return "keep2share.cc";
};
});
getAllBanners().add(new AvailableBanner(DomainInfo.getInstance("ddownload.com")));
getAllBanners().add(new AvailableBanner(DomainInfo.getInstance("filejoker.net")));
getAllBanners().add(new AvailableBanner("ddownload.com"));
getAllBanners().add(new AvailableBanner("filejoker.net"));
updateDelayer.resetAndStart();
refreshThread.start();
}
@ -829,7 +829,7 @@ public class BannerRotation implements Sponsor, AccountControllerListener {
} else {
customURL = null;
}
final Icon fav = DomainInfo.getInstance(account.getHoster()).getFavIcon(false);
final Icon fav = account.getDomainInfo().getFavIcon(false);
final ExtMergedIcon hosterIcon = new ExtMergedIcon(new AbstractIcon(IconKey.ICON_REFRESH, 32)).add(fav, 32 - fav.getIconWidth(), 32 - fav.getIconHeight());
final ConfirmDialog d = new ConfirmDialog(UIOManager.LOGIC_COUNTDOWN | Dialog.STYLE_SHOW_DO_NOT_DISPLAY_AGAIN, title, msg, hosterIcon, _GUI.T.lit_continue(), _GUI.T.lit_close()) {
@Override

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -192,10 +191,7 @@ public class SingleFilterResultTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}
@ -204,10 +200,7 @@ public class SingleFilterResultTableModel extends ExtTableModel<CrawledLink> {
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}

View File

@ -5,7 +5,6 @@ import java.util.Arrays;
import javax.swing.Icon;
import jd.controlling.linkcrawler.CrawledLink;
import jd.http.Browser;
import org.appwork.swing.components.CheckBoxIcon;
import org.appwork.swing.exttable.ExtTableModel;
@ -179,10 +178,7 @@ public class ViewTestResultTableModel extends ExtTableModel<CrawledLink> {
}
protected Icon getIcon(final CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}
@ -191,10 +187,7 @@ public class ViewTestResultTableModel extends ExtTableModel<CrawledLink> {
@Override
public String getStringValue(CrawledLink value) {
DomainInfo domain = value.getDomainInfo();
if (domain == null) {
domain = DomainInfo.getInstance(Browser.getHost(value.getURL()));
}
final DomainInfo domain = value.getDomainInfo();
if (domain == null) {
return null;
}

View File

@ -7,24 +7,23 @@ import java.util.List;
import javax.swing.Icon;
import javax.swing.SwingUtilities;
import org.appwork.swing.components.tooltips.ExtTooltip;
import org.appwork.swing.components.tooltips.ToolTipController;
import org.appwork.swing.exttable.columns.ExtTextColumn;
import org.appwork.utils.StringUtils;
import org.appwork.utils.images.IconIO;
import org.jdownloader.DomainInfo;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.downloads.columns.candidatetooltip.CandidateTooltip;
import org.jdownloader.images.BadgeIcon;
import org.jdownloader.images.NewTheme;
import jd.controlling.downloadcontroller.HistoryEntry;
import jd.controlling.packagecontroller.AbstractNode;
import jd.gui.swing.jdgui.GUIUtils;
import jd.plugins.Account;
import jd.plugins.DownloadLink;
import org.appwork.swing.components.tooltips.ExtTooltip;
import org.appwork.swing.components.tooltips.ToolTipController;
import org.appwork.swing.exttable.columns.ExtTextColumn;
import org.appwork.utils.StringUtils;
import org.appwork.utils.images.IconIO;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.downloads.columns.candidatetooltip.CandidateTooltip;
import org.jdownloader.images.BadgeIcon;
import org.jdownloader.images.NewTheme;
public class CandidateAccountColumn extends ExtTextColumn<AbstractNode> {
private final Icon iconDownload = NewTheme.I().getIcon(IconKey.ICON_DOWNLOAD, 20);
@ -78,9 +77,9 @@ public class CandidateAccountColumn extends ExtTextColumn<AbstractNode> {
Account account = history.getAccount();
if (account != null) {
if (icon == null) {
icon = DomainInfo.getInstance(account.getHosterByPlugin());
icon = account.getDomainInfo();
} else {
icon = new BadgeIcon(DomainInfo.getInstance(account.getHosterByPlugin()), IconIO.getScaledInstance(icon, 12, 12), 4, 2);
icon = new BadgeIcon(account.getDomainInfo(), IconIO.getScaledInstance(icon, 12, 12), 4, 2);
}
String accountType = null;
switch (history.getAccountType()) {

View File

@ -31,7 +31,6 @@ import org.appwork.swing.components.JScrollPopupMenu;
import org.appwork.swing.exttable.ExtMenuItem;
import org.appwork.swing.exttable.columns.ExtComboColumn;
import org.appwork.utils.event.queue.QueueAction;
import org.jdownloader.DomainInfo;
import org.jdownloader.controlling.linkcrawler.LinkVariant;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.translate._GUI;
@ -109,7 +108,7 @@ public class VariantColumn extends ExtComboColumn<AbstractNode, LinkVariant> {
public void fillPopupWithPluginSettingsButton(final JPopupMenu popup, final CrawledLink link) {
popup.add(new JMenuItem(new BasicAction() {
{
setSmallIcon(new BadgeIcon(new AbstractIcon(IconKey.ICON_SETTINGS, 18), DomainInfo.getInstance(link.getDownloadLink().getDefaultPlugin().getHost()).getIcon(10), 0, 0).crop(18, 18));
setSmallIcon(new BadgeIcon(new AbstractIcon(IconKey.ICON_SETTINGS, 18), link.getDomainInfo().getIcon(10), 0, 0).crop(18, 18));
setName(_GUI.T.VariantColumn_fillPopup_settings(link.getDownloadLink().getDefaultPlugin().getHost()));
}

View File

@ -2,7 +2,7 @@ package org.jdownloader.plugins.controller.host;
import jd.plugins.PluginForHost;
import org.appwork.utils.StringUtils;
import org.jdownloader.DomainInfo;
import org.jdownloader.plugins.controller.LazyPlugin;
import org.jdownloader.plugins.controller.LazyPluginClass;
import org.jdownloader.plugins.controller.PluginClassLoader.PluginClassLoaderChild;
@ -123,6 +123,10 @@ public class LazyHostPlugin extends LazyPlugin<PluginForHost> {
setProperty(premium, PROPERTY.PREMIUM);
}
public DomainInfo getDomainInfo() {
return DomainInfo.getInstance(getHost());
}
private String configInterface = null;
public LazyHostPlugin(LazyPluginClass lazyPluginClass, String pattern, String displayName, Class<PluginForHost> pluginClass, PluginClassLoaderChild classLoaderChild) {